akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<queue>
using namespace  std;
int main(){
	int a,b;
	while(scanf("%d%d",&a,&b),a){
		queue<int>Q;
		for(int i=0;i<a;i++)Q.push(i+1);
		int now=1;
		while(Q.size()>1){
			int t=Q.front();
			if(now%b!=0){
				Q.push(t);
			}
			now++;
			Q.pop();
		}
		printf("%d\n",Q.front());
	}
}

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

using namespace std;

int main()
{
    int r[505][505], a[505][505], t, u, best;
    char in;

    cin >> t >> u;

    for(int i = 1; i <= t; ++i){
        best = 1;
        a[i][1] = 1;
        for(int j = 1; j <= u; ++j){
            cin >> in;
            if(in == '#'){
                r[i][j] = 1;
                a[i][j] = 1;
                if(a[i][j - 1] || a[i - 1][j])
                    best = j;
                else
                    for(int k = j; k >= best; --k){
                        a[i][k] = 1;
                        if(a[i][k - 1] || a[i - 1][k])
                            break;
                    }
            }
        }
    }
    for(int i = 1; i <= t; ++i){
        for(int j = 1; j <= u; ++j){
            if(a[i][j])
                cout << "#";
            else
                cout << ".";
        }
        cout << endl;
    }
    cout << endl;
    for(int i = 1; i <= t; ++i){
        for(int j = 1; j <= u; ++j){
            if(r[i][j] || !a[i][j])
                cout << "#";
            else
                cout << ".";
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 2816
n=gets.to_i
pref=""
after=""
pref=gets.chomp
preflist=[pref]
f=1
(n-1).times{
  after=gets.chomp
  if pref[-1]!=after[0] || preflist.include?(after) then
    puts "No"
    f=0
    break
  end
  preflist << after
  pref=after
}
if f==1 then puts "Yes" end

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 5LL << 60;
const ll mod = 1e9 + 7;

int main() {
	int N;
	cin >> N;
	int last = N % 10;
	string ans;
	if(last == 3)
		ans = "bon";
	else if(last == 0 || last == 1 || last == 6 || last == 8)
		ans = "pon";
	else
		ans = "hon";
	cout << ans;
	return 0;
}

Measured memory_bytes: 3628
A, B = map(int, input().split())

prc1 = A / 0.08
prc1e = (A+1) / 0.08
prc2 = int(B / 0.1)
prc2e = int((B+1) / 0.1)

for p in range(prc2, prc2e):
    if A == int(p*0.08):
        print(p)
        break
else:
    print(-1)

Measured memory_bytes: 3064
#include<iostream>
//#include<bits/stdc++.h>
#include<cstring>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;


const ll mod = 1e9;

vector<ll> q,p;

bool ok(ll x,ll n,ll k)
{
    ll ans = 0;
    sort(q.begin(),q.end(),greater<ll>());
    sort(p.begin(),p.end());
    int s1 = q.size(),s2 = p.size();
    for(int i = 0; i < s1; ++i)
    {
        int l = i,r = s1-1;
        while(l < r)
        {
            int mid = l + r +1 >>1;
            if(q[i]*q[mid] <= x) l = mid;
            else r = mid - 1;
        }
        if(l > i) ans += l -i ;
    }
    for(int i = 0; i < s2; ++i)
    {
        int l = i,r = s2 - 1;
        while(l < r)
        {
            int mid = l + r + 1 >> 1;
            if(p[i]*p[mid] <= x) l = mid;
            else r = mid - 1;
        }
        if(l > i) ans += l - i ;
    }
    if(ans >= k) return 1;
   // reverse(q.begin(),q.end());
    reverse(p.begin(),p.end());
    for(int i = 0; i < s1; ++i)
    {
        int l = -1,r = s2-1;
        while(l < r)
        {
            int mid = l + r + 1>>1;
            if(q[i] * p[mid] <=  x) l = mid;
            else r = mid - 1;
        }
        if(l != -1) ans += l + 1;
    }
    return ans >= k;


}
int main()
{
    ll n,k,a;
    scanf("%lld%lld",&n,&k);

    for(int i = 1; i <= n; ++i)
    {
        scanf("%lld",&a);
        if(a<0) q.push_back(a);
        else  p.push_back(a);
    }
    ll l = - mod * mod ,r = mod *mod;
    while(l < r)
    {
        ll mid = l + r >>1;
        if(ok(mid,n,k)) r = mid;
        else l = mid + 1;
    }
    cout << r;
}





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

using namespace std;

long long n, id, tot;

vector<long long> st, ed;

int main()
{
	cin >> n;
	while (n)
	{
		if (n & 1) ed.push_back(tot++), n >>= 1;
		else st.push_back(tot++), n--;
	}
	
	tot = st.size() + ed.size();
	
	cout << tot + 100 << endl;
	for (int i = 0; i < st.size(); i++) cout << tot-st[i] << " ";
	for (int i = ed.size()-1; i >= 0; i--) cout << tot-ed[i] << " ";
	for (int i = 1; i <= 100; i++) cout << i << " ";
	
	return 0;
}

Measured memory_bytes: 3220
//All Pairs Shortest Path
#include <iostream>
#include <climits>

using namespace std;

static const int MAX = 100;
int V, E;
long long A[MAX][MAX];

void warshallFloyd() {
    for(int k=0; k<V; k++) {
        for(int i=0; i<V; i++) {
            for(int j=0; j<V; j++) {
                if(A[i][k] == LONG_LONG_MAX || A[k][j] == LONG_LONG_MAX)
                    continue;
                A[i][j] = min(A[i][j], A[i][k]+A[k][j]);
            }
        }
    }
}

int main() {
    int s, t;
    long long d;
    cin >> V >> E;

    for (int i=0; i<V; i++)
        for (int j=0; j<V; j++)
            A[i][j] = (i == j ? 0 : LONG_LONG_MAX);

    for (int i=0; i<E; i++) {
        cin >> s >> t >> d;
        A[s][t] = d;
    }

    warshallFloyd();

    bool flg = false;
    for(int i=0; i<V; i++)
        if(A[i][i] < 0)
            flg = true;

    if(flg) cout << "NEGATIVE CYCLE" << endl;
    else {
        for(int i=0; i<V; i++) {
            for (int j=0; j<V; j++) {
                if(j !=  0) cout << " ";
                if(A[i][j] == LONG_LONG_MAX) cout << "INF";
                else cout << A[i][j];
            }
            cout << endl;
        }
    }

    return 0;
}


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

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

const int MN = 200010;

int N;
pii P[MN];
ll ans;

int Xn;
vector<int> X;
map<int, int> dx;

struct Fenwick {
    vector<int> tree;
    void init() {
        tree = vector<int>(Xn + 1, 0);
    }
    void upd(int idx, int val) {
        for(int i = idx + 1; i <= Xn; i += (i & -i)) tree[i] += val;
    }
    int kquer(int k) {
        int ret = 0;
        for(int i = 20; i >= 0; i--) {
            if(ret + (1 << i) > Xn) continue;
            if(tree[ ret + (1 << i) ] < k) {
                k -= tree[ ret + (1 << i) ];
                ret += (1 << i);
            }
        }
        return ret;
    }
} fw;

vector<pii> E[MN << 1];

int main() {
    scanf("%d", &N);

    int mn1 = 1e9;
    int mn2 = 1e9;
    int mx1 = -1e9;
    int mx2 = -1e9;
    for(int i = 0; i < N; i++) {
        scanf("%d %d", &P[i].first, &P[i].second);
        if(P[i].first > P[i].second) swap(P[i].first, P[i].second);
        mn1 = min(mn1, P[i].first);
        mx1 = max(mx1, P[i].first);
        mn2 = min(mn2, P[i].second);
        mx2 = max(mx2, P[i].second);

        X.push_back(P[i].first);
        X.push_back(P[i].second);
    }

    ans = 1LL * (mx1 - mn1) * (mx2 - mn2);

    sort(X.begin(), X.end());
    X.resize(unique(X.begin(), X.end()) - X.begin());
    Xn = X.size();
    for(int i = 0; i < Xn; i++) dx[X[i]] = i;
    for(int i = 0; i < N; i++) {
        P[i].first = dx[ P[i].first ];
        P[i].second = dx[ P[i].second ];

        E[ P[i].first ].push_back({ P[i].first, 1 });
        E[ P[i].first ].push_back({ P[i].second, -1 });
        E[ P[i].second ].push_back({ P[i].second, 1 });
    }

    fw.init();
    for(int i = Xn - 1; i >= 0; i--) {
        for(int j = 0; j < E[i].size(); j++) {
            fw.upd(E[i][j].first, E[i][j].second);
        }
        int x = fw.kquer(N);
        if(x == Xn) continue;

        //cout << i << ' ' << X[i] << ' ' << X[x] << endl;

        ans = min(ans, 1LL * (mx2 - mn1) * (X[x] - X[i]));
    }
    printf("%lld", ans);
}


Measured memory_bytes: 45552
#include<stdio.h>
#include<math.h>

int a,b,i,j;
int main()
{
     scanf("%d %d",&a,&b);
     int fm[a+10][b+10];int sum[a+10];

     for(i=1;i<=a;i++)
     {
         sum[i]=0;
         for(j=1;j<=b;j++)
        {
            scanf("%d",&fm[i][j]);
        }
     }

     int x[a+10]; 
     
     for(i=1;i<=b;i++) scanf("%d",&x[i]);

    for(i=1;i<=a;i++)
     {
         for(j=1;j<=b;j++)
        {
            sum[i]=sum[i]+fm[i][j]*x[j];
        }

     }
     for(i=1;i<=a;i++)printf("%d\n",sum[i]);



}



Measured memory_bytes: 2780
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　 |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/
 
 

 
int N, X, A[201010];
ll B[201010];
//---------------------------------------------------------------------------------------------------
ll get(int a, int b) {
    ll res = B[b];
    if (a) res -= B[a - 1];
    return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> X;
    rep(i, 0, N) cin >> A[i];
    B[0] = A[0];
    rep(i, 0, N) B[i] = B[i - 1] + A[i];
 
    ll ans = infl;
    rep(k, 1, N + 1) {
        ll sm = 0;
        int R = N - 1;
        ll p = 5;
        while (0 <= R) {
            int L;
            if (R == N - 1) L = R - 2 * k + 1;
            else L = R - k + 1;
            L = max(L, 0);
 
            sm = min(infl, sm + get(L, R) * p);
            
            R = L - 1;
            p += 2;
        }
        sm = min(infl, sm + 1LL * X * (N + k));
        chmin(ans, sm);
    }
 
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define forn(i,a,b) for(int i =a;i<b;i++)
#define fi first
#define se second
#define fast ios_base::sync_with_stdio(false);
using namespace std;

//for debugging 
/*
g++ -D_GLIBCXX_ASSERTIONS -DDEBUG -ggdb3 -std=c++14 
*/
int recur_depth = 0;
#ifdef DEBUG
#define dbg(x) {++recur_depth; auto x_=x; --recur_depth; cerr<<string(recur_depth, '\t')<<"\e[91m"<<__func__<<":"<<__LINE__<<"\t"<<#x<<" = "<<x_<<"\e[39m"<<endl;}
#else
#define dbg(x)
#endif
template<typename Ostream, typename Cont>
typename enable_if<is_same<Ostream,ostream>::value, Ostream&>::type operator<<(Ostream& os,  const Cont& v){
	os<<"[";
	for(auto& x:v){os<<x<<", ";}
	return os<<"]";
}
template<typename Ostream, typename ...Ts>
Ostream& operator<<(Ostream& os,  const pair<Ts...>& p){
	return os<<"{"<<p.first<<", "<<p.second<<"}";
}
// debugging ends here

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


void solve(){
	
	ll x,k,d;
	cin >> x >> k >> d;
	x = abs(x);
	if(x/k>=d){
		cout << x - k*d << endl;
	}
	else{
		ll r = x%d;
		ll l = (x-r)/d;
		if(l%2ll == k % 2ll){
			cout << r << endl;
		}
		else{
			cout << d-r << endl;
		}
	}

}

int main(){
	fast;
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif

	// int t;cin >> t;while(t--)
		solve();
}


Measured memory_bytes: 3652
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,i,j;
	char z[1000];
	while(1){
		s=0;
		d=0;
		scanf("%s",z);
		a=strlen(z);
		if(z[0]=='0') break;
		for(i=1;i<a;i++){
			if(z[i]=='A') s++;
			if(z[i]=='B') d++;
		}
		if(s<d) d++;
		else s++;
		printf("%d %d\n",s,d);
	}
	return 0;
}

Measured memory_bytes: 2636
// template version 1.12
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings
#define infile "../test/sample-1.in"
#define int long long //{{{
const int INF=1e18;
const int MOD=1e9+7; //}}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define ceil(a,b) ((a)+(b)-1)/(b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
  #include "lib/dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
//}}}

int solve(){
  int n,k;cin>>n>>k;
  string s;cin>>s;

  int unh=0;
  rep(i,1,n+1){
    if (s[i-1]=='L') {
      if (i==1 || s[i-1]!=s[i-2]) unh++;
    }
    if (s[i-1]=='R') {
      if (i==1 || s[i-1]!=s[i-2]) unh++;
    }
  }
  dump(unh);

  while(k>0){
    if (unh>=3) unh -= 2;
    else if (unh==2){
      unh = 1;
      break;
    }
    else if (unh==1){
      unh = 1;
      break;
    }
    k--;
  }
  cout << n-unh << endl;

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 512
<?php
    while(true){
        list($height, $width) = explode(" ",trim(fgets(STDIN)));

        if($height == 0 && $width == 0) exit;
    
        $bar[0] = str_repeat("#.",floor($width / 2));
        $bar[1] = str_repeat(".#",floor($width / 2));
        
        if($width % 2 == 1){
            $bar[0] .= "#";    
            $bar[1] .= ".";    
        }

        for($j = 0; $j < $height ; $j++){
            print $bar[$j % 2]."\n";
        }
        print "\n";
    }    

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

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

int v[8][8];



int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    int a,b;
    cin>>a>>b;
    if(a==b){
        cout<<"Draw"<<endl;
    }
    else if(a>b && b!=1){
        cout<<"Alice"<<endl;
    }
    else if(a==1){
        cout<<"Alice"<<endl;
    }
    else{
        cout<<"Bob"<<endl;
    }
    return 0;
}


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

int main(){
  int R,C,K;
  cin>>R>>C>>K;
  vector<vector<int64_t>> p(R,vector<int64_t>(C));
  for(int i=0;i<K;i++){
    int a,b;
    int64_t c;
    cin>>a>>b>>c;
    a--,b--;
    p[a][b]=c;
  }
  vector<vector<vector<int64_t>>> dp(R,vector<vector<int64_t>>(C,vector<int64_t>(4)));
  dp[0][0][1]=p[0][0];
  for(int a=1;a<R+C-1;a++){
    for(int b=0;b<C;b++){
      int i=a-b,j=b;
      if(i<0||R<=i){
        continue;
      }
      for(int k=0;k<4;k++){
        int64_t A=0;
        if(j!=0){
          A=dp[i][j-1][k];
          if(k!=0){
            A=max(A,dp[i][j-1][k-1]+p[i][j]);
          }
        }
        if(i!=0&&k<2){
          for(int l=0;l<4;l++){
            A=max(A,dp[i-1][j][l]+p[i][j]*k);
          }
        }
        dp[i][j][k]=A;
      }
    }
  }
  int64_t Z=0;
  for(int k=0;k<4;k++){
    Z=max(Z,dp[R-1][C-1][k]);
  }
  cout<<Z<<endl;
}


Measured memory_bytes: 707216
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        String[] w = new String[n];
        for (int i = 0; i < n; i++) {
            w[i] = sc.next();
        }

        // 主処理
        Set<String> set = new HashSet<>(Arrays.asList(w));
        boolean isObey = set.size() == n;
        if (isObey) {
            for (int i = 0; i < n - 1; i++) {
                char end = w[i].charAt(w[i].length() - 1);
                char start = w[i + 1].charAt(0);
                isObey = isObey && (end == start);
            }
        }

        String result = isObey ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 21716
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

N = int(input())

a = [0]*N
a[0]=3
a_candi=int(0)

for i in range(N-1):
    a_candi = a[i]+10
    while (a_candi<55555):
        if is_prime(a_candi):
            a[i+1]=a_candi
            break
        else:
            a_candi += 10

print(' '.join(map(str, a)))



Measured memory_bytes: 3064
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1001001001LL;
constexpr long long LINF = 1001001001001001001;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define rept(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main(){ 
    string s; cin >> s;
    if(s.back()=='s')s += "es";
    else s += "s";
    cout << s << ln;
}



Measured memory_bytes: 3628
// Original: https://github.com/tanakh/competitive-rs
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::HashMap;

fn main() {
    input!(n: usize, a: usize, xs: [usize; n]);

    let nax = n * 50 + 10;
    // dp[j][k][s]: x_1 .. x_j からk枚選んだときの合計がsになるような選び方の総数
    let mut dp = vec![vec![vec![0usize; nax]; n + 10]; n + 10];

    for j in 0..n + 1 {
        for k in 0..n + 1 {
            for s in 0..nax {
                if j == 0 && k == 0 && s == 0 {
                    dp[j][k][s] = 1;
                } else if j >= 1 && s < xs[j - 1] {
                    dp[j][k][s] = dp[j - 1][k][s];
                } else if j >= 1 && k >= 1 && s >= xs[j - 1] {
                    dp[j][k][s] = dp[j - 1][k][s] + dp[j - 1][k - 1][s - xs[j - 1] as usize];
                } else {
                    dp[j][k][s] = 0;
                }
            }
        }
    }

    let mut ans = 0usize;
    for k in 1..n + 1 {
        // k枚えらんだときの合計の平均がa => 合計がk * a
        ans += dp[n][k][k * a as usize];
    }
    println!("{}", ans);
}


Measured memory_bytes: 92412
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;

void dfs(int pos,vector<int> &color,vector<vector<pair<int,int> > > &v,int nowcolor){
    color[pos]=nowcolor;
    for(int i=0;i<v[pos].size();i++){
        if(color[v[pos][i].first]==-1){
            if(v[pos][i].second%2==0) dfs(v[pos][i].first,color,v,nowcolor);
            else  dfs(v[pos][i].first,color,v,1-nowcolor);
        }
    }
}

int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int n;
    cin>>n;
    vector<vector<pair<int,int> > > v(n);
    vector<int> color(n,-1);

    rep(i,n-1){
        int U,V,W;
        cin>>U>>V>>W;
        U--;V--;
        v[U].push_back(mp(V,W));
        v[V].push_back(mp(U,W));
    }
    dfs(0,color,v,0);
    rep(i,n){
        cout<<color[i]<<endl;
    }
    
//////////////////////////////////////////////////////
return 0;}


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

int main () {
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.size()-2; i++){
    int num = 100*(s.at(i)-'0') + 10*(s.at(i+1)-'0') + (s.at(i+2) -'0');
    int dif = 0;
    if (753 > num) dif = 753 - num;
    else dif = num - 753;
    if ((ans > dif) || (i == 0)) ans = dif;
  }
  cout << ans << endl;
}

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

long long int N, a, b[100000], i, ret = 1, bi = 2;
char c;

int main(){
    for(c = getchar(); c != 10; c = getchar()){
        N = ((N * 5) << 1) + c - 48;
    }
    ++(*b);
    for(i = 0; i < N; ++i){
        for(c = getchar(), a = 0; c != 32 && c != 10; c = getchar()){
            a = ((a * 5) << 1) + c - 48;
        }
        ++b[a];
    }
    for(i = ~N & 1; i < N; i += 2){
        if(b[i] != 2){
            puts("0");
            return 0;
        }
    }
    N >>= 1;
    while(N){
        if(N & 1){
            ret *= bi;
            ret %= 1000000007;
        }
        bi *= bi;
        bi %= 1000000007;
        N >>= 1;
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <math.h>

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
#define PI 3.14159265359
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define SIZE_OF_ARRAY(array) (sizeof(array) / sizeof(array[0]))

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

  cout << (X - A) % B << endl;

  return 0;
}


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

using ll = long long;

using namespace std;

int main() {
    int n;
    cin >> n;
    int mi = n, cnt = 0;
    for (int i=0, pi; i<n; i++) {
        cin >> pi;
        if (mi >= pi) cnt++;
        mi = min(mi, pi);
    }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
const int N=2e5+10;
int lazy[4*N];
int a[N];
vector<int> b(N+1);
int get(int idx,int l,int r,int id){
	if(l==r) {
		b[l]+=lazy[idx];
		lazy[idx]=0;
		return b[l];
	}
	int mid=(l+r)/2;
	lazy[2*idx]+=lazy[idx];
	lazy[2*idx+1]+=lazy[idx];
	lazy[idx]=0;
	if(id>mid) {
		return get(2*idx+1,mid+1,r,id);
	}
	else{
		return get(2*idx,l,mid,id);
	}
}
void update(int idx,int l,int r,int x,int y,int add){
	if(l>=x && r<=y) {
		lazy[idx]+=add;
		return;
	}
	if(x>r || y<l) {
		return;
	}
	int mid=(l+r)/2;
	update(2*idx,l,mid,x,y,add);
	update(2*idx+1,mid+1,r,x,y,add);
}
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n;
	int k; cin>>k;
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	for(int d=1; d<=k; d++) {
		b.clear();
		b.resize(n+1);
		memset(lazy,0,sizeof lazy);
		for(int i=1; i<=n; i++) {
			int lol=a[i];
			update(1,1,n,max(i-lol,1),min(i+lol,n),1);
		}
		for(int i=1; i<=n; i++) {
			a[i]=get(1,1,n,i);
			//cout<<a[i]<<" ";
		}

		//cout<<endl;
		bool cycle=true;
		for(int j=1; j<=n; j++) {
			if(a[j]!=n) {
				cycle=false;
				break;
			}
		}
		if(cycle) {
			break;
		}
	}
	for(int i=1; i<=n; i++) {
		cout<<a[i]<<" ";
	}
	cout<<endl;

	return 0;
}


Measured memory_bytes: 7848
N, M = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(N)]
a = []
if N > 1:
  for i in range(N):
    a.append(A[i][1:])

  ans = 0
  for x in range(len(a[0])):
    for y in range(N - 1):
      if a[0][x] in a[y + 1]:
        if y + 1 == N - 1:
          ans += 1
      else:
        break
  print(ans)
else:
  print(A[0][0])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;

int main(){
	int n;
	scanf("%d", &n);
	std::vector<P> ab(n);
	for(int i=0; i<n; i++) scanf("%ld %ld", &ab[i].first, &ab[i].second);
	std::sort(ab.begin(), ab.end(), [](P x, P y){
		return x.first+x.second > y.first+y.second;
	});
	
	ll ans = 0;
	for(int i=0; i<n; i++){
		if(i%2==0) ans += ab[i].first;
		else ans -= ab[i].second;
	}
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 1792
#include<iostream>

using namespace std;

const int MAX = 1001;

int sumj[MAX][MAX],sumo[MAX][MAX], sumi[MAX][MAX];
char data[MAX][MAX];
int x,y;

void make(){
  for(int i = 1; i <= y; i++){
    for(int j = 1; j <= x; j++){
      sumj[i][j] = sumj[i-1][j]+sumj[i][j-1]-sumj[i-1][j-1];
      sumo[i][j] = sumo[i-1][j]+sumo[i][j-1]-sumo[i-1][j-1];
      sumi[i][j] = sumi[i-1][j]+sumi[i][j-1]-sumi[i-1][j-1];
      if(data[i][j] == 'J') sumj[i][j]++;
      if(data[i][j] == 'O') sumo[i][j]++;
      if(data[i][j] == 'I') sumi[i][j]++;
    }
  }
}

int main(){
  cin >> y >> x;
  string trash;
  int num;
  cin >> num;
  for(int i = 1; i <= y; i++)
    for(int j = 1; j <= x; j++) cin >> data[i][j];
  make();
  for(int i = 0; i < num; i++){
    int po[4];
    cin >> po[0] >> po[1] >> po[2] >> po[3];
    cout << sumj[po[2]][po[3]]-sumj[po[2]][po[1]-1]-sumj[po[0]-1][po[3]]+sumj[po[0]-1][po[1]-1] << " ";
    cout << sumo[po[2]][po[3]]-sumo[po[2]][po[1]-1]-sumo[po[0]-1][po[3]]+sumo[po[0]-1][po[1]-1] << " ";
    cout << sumi[po[2]][po[3]]-sumi[po[2]][po[1]-1]-sumi[po[0]-1][po[3]]+sumi[po[0]-1][po[1]-1] <<endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
//#include<numeric>
#define MOD 1000000007
typedef long long ll;
using namespace std;


int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}

int main(){
    //cin.tie(0);ios::sync_with_stdio(false);
    int k; cin >> k;
    int gcd_table[205][205];
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            gcd_table[i][j] = gcd(i,j);
        }
    }

    ll ans = 0;
    /*
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans += gcd(gcd_table[i][j], gcd_table[gcd_table[i][j]][l]);
            }
        }
    }*/
    for(int i=1;i<=k;i++){
        for(int j=1;j<=k;j++){
            for(int l=1;l<=k;l++){
                ans += gcd(gcd_table[i][j],l);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3764
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
   int n,k;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++)
        cin>>a[i];
    vector<bool> dp(k+1,false);
    for(int i=1;i<=k;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(i>=a[j]&&dp[i-a[j]]==false)
                dp[i]=true;
        }
    }
    string s="";
    s=dp[k]==true?"First":"Second";
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 3640
N,M = map(int,input().split())

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

if N == 1 or N == 0:
    a = 0
else:
    a = cmb(N,2)
if M == 1 or M == 0:
    b = 0
else:
    b = cmb(M,2)
print(a+b)

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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;



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

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

	if (a > 0 && b > 0) {
		out("Positive");
	}
	else if(a < 0 && b < 0) {
		if ((b - a + 1) % 2 == 0) {
			out("Positive");
		}
		else {
			out("Negative");
		}
	}
	else {
		out("Zero");
	}

	return 0;
}

Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
import collections
data=collections.Counter(a)
a=[]
a_4=[]
for i,j in data.items():
    if 4<=j:
        a_4.append(i)
    elif 2<=j:
        a.append(i)
x=y=z=0
a.sort()
a.reverse()
a_4.sort()
a_4.reverse()

if len(a_4)==0 and len(a)<=1:
    print(0)
    exit()
if 1<=len(a_4) and 1<=len(a):
    x=a[0]*a_4[0]
if 2<=len(a):
    y=a[0]*a[1]
if 1<=len(a_4):
    z=a_4[0]*a_4[0]
print(max(x,y,z))

Measured memory_bytes: 18448
/*
 _____ ____ _____   ___   ___   ___   ___ 
|_   _/ __ \_   _| |__ \ / _ \ |__ \ / _ \
  | || |  | || |      ) | | | |   ) | | | |
  | || |  | || |     / /| | | |  / /| | | |
 _| || |__| || |_   / /_| |_| | / /_| |_| |
|_____\____/_____| |____|\___/ |____|\___/ 
*/
#include <bits/stdc++.h>
#include <fstream>
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define per(i, a, b) for (int i = (a); i > (b); i--)
#define a(x) (x.begin(), x.end())
#define ar(x) (x.rbegin(), x.rend())
#define pb push_back
#define Pb() pop_back()
#define ll long long int
#define ull unsigned long long int
#define pii pair<int, int>
#define pll pair<ll, ll>
#define sc scanf
#define scin(x) sc("%d", &(x))
#define scln(x) sc("%lld", &(x))
#define pf prllf
#define ms(a, b) memset(a, b, sizeof(a))
#define mp make_pair
#define db double
#define EPS 10E-10
#define ff first
#define ss second
#define sqr(x) (x) * (x)
#define vi vector<int>
#define vl vector<ll>
#define vii vector<vector<int>>
#define vll vector<vector<ll>>
#define DBG pf("HI\n")
#define MOD 1000000007
#define CIN                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define RUN_CASE(t, T) for (__typeof(t) t = 1; t <= T; t++)
#define CASE(t) prllf("Case %d: ", t)
#define CASEL(t) prllf("Case %d:\n", t)
#define intlimit 2147483647
#define longlimit 9223372036854775807
#define infinity (1 << 28)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b) / gcd(a, b))
#define PI 2 * acos(0.0)
// pair<int,int>ert(x==y); gives run time when false
using namespace std;
int main()
{
     CIN;
    ll n,m;
    cin >> n >> m;
    ll n1 = n/2,m1 = m/2;
    ll sum = n1*m1;
    if(n%2==1)n1++;
    if(m%2==1)m1++;
    sum+=n1*m1;
    if(n==1||m==1){
        cout << 1;
        return 0;
    }
    cout << sum;
}

Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main(){
    input!{
        a: isize,
        s: String,
        b: isize,
    };
    let ret = if &*s == "+" {a+b} else {a-b};
    println!("{}", ret);

}


Measured memory_bytes: 4352
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

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

    int cnt4 = 0;
    int cnt6 = 0;
    for(int i=0; i<N; i++){
        int sz = adj[i].size();
        if(sz % 2){
            cout << "No" << endl;
            return 0;
        }
        if(sz == 4)
            cnt4++;
        if(sz >= 6)
            cnt6++;
    }
    if(cnt4 >= 3 || cnt6 >= 1){
        cout << "Yes" << endl;
        return 0;
    }
    if(cnt4 == 2){
        vector<int> v;
        for(int i=0; i<N; i++)
            if(adj[i].size() == 4)
                v.push_back(i);

        int s = v[0];
        int t = v[1];

        queue<pair<int, int>> que;
        que.push(make_pair(s, -1));
        bool ok = false;
        while(!que.empty()){
            auto fr = que.front();
            que.pop();
            int cur = fr.first;
            int pre = fr.second;

            for(int ss : adj[cur]){
                if(ss == t) continue;
                if(ss == pre) continue;
                if(ss == s){
                    ok = true;
                    break;
                }
                que.push(make_pair(ss, cur));
            }
            if(ok)
                break;
        }
        if(ok){
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 5760
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int n,x;
string str;

class data{
	public:
	string str;
	int x;
};

bool comp(const data &left,const data &right){
	return left.str<right.str;
}
bool comp2(const data &left,const data &right){
	if(left.str.size()==right.str.size())return left.str<right.str;
	return left.str.size()<right.str.size();
	//return left.x>right.x;
}

vector<data> que;
vector<data> que2;

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		cin >> str >> x;
		data q;
		q.str=str;
		q.x=x;
		que.push_back(q);
	}
	sort(que.begin(),que.end(),comp);
	string str2=que[0].str;
	int x=que[0].x;
	for(int i=1;i<que.size();i++){
		if(que[i].str==str2)x+=que[i].x;
		else{
			data q;
			q.str=str2;
			q.x=x;
			que2.push_back(q);
			str2=que[i].str;
			x=que[i].x;
		}
	}
	data q;
	q.str=str2;
	q.x=x;
	que2.push_back(q);
	sort(que2.begin(),que2.end(),comp2);
	for(int i=0;i<que2.size();i++)cout << que2[i].str << " " << que2[i].x << endl;
	return 0;
}

Measured memory_bytes: 1800
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define ppp pair<pii,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define CL(x) memset(x,0,sizeof(x))
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)(x.size())
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
#define DI(x) (int)(x-'0')
#define LL_MAX (1LL<<60)
#define DB 0
#define DBG(x) if(DB)cout << #x << " : " << x << '\n'
#define PRALL(v) if(DB)for(auto it : v)cout<<v<<' '; NL;
#define NL cout<<'\n';
#define FND(S,x) (S.find(x)!=S.end())
#define bit(x,y) (!!(x&(1<<y)))
typedef long long ll;
typedef long double ld;

#define MXN 200005
int N;
int A[MXN];
map<int,int> cnt;
set<int> Set;
#define MXA 1000005
int mxa = 1000000;
bool F[MXA];

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

    cin>>N;
    FOR(i,1,N)
    {
        cin>>A[i];
        Set.insert(A[i]);
        cnt[ A[i] ]++;
    }
    int ans = 0;
    for( int Si : Set )
    {
        if( !F[Si] && cnt[Si]==1 )ans+=cnt[Si];
        for( int x = Si*2; x<=mxa; x+=Si )
        {
            F[x] = 1;
        }
    }
    cout<<ans<<'\n';

    return 0;
}


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

int main(void) {
	int a, b;
	string op;
	
	while (true)
	{
		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 if (op == "?")
		{
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 3160
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<tgmath.h>
#include<stdbool.h>
#include<sys/queue.h>
#include<time.h>
#define ll long long
#define min(a, b) ((a) > (b) ? (b) : (a))
#define max(a, b) ((a) > (b) ? (a) : (b))

const int INF = 1001001001;
const int NIL = -1;

int h, w, ans = 0, d[99][99], dx[]={1,0,-1,0}, dy[]={0,1,0,-1};
char s[99][99];

int meiro(int x, int y){
    if(s[x][y] == '#') return 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            d[i][j] = NIL;
        }
    }
    int que[400], l=0, r=0;
    que[r++] = x*1000 + y;
    d[x][y] = 0;
    while(r != l){
        int a=que[l]/1000, b=que[l]%1000;
        l++;
        for(int i=0; i<4; i++){
            int nx = a+dx[i], ny = b+dy[i];
            if(0<=nx&&nx<h && 0<=ny&&ny<w && s[nx][ny]=='.' && d[nx][ny]==NIL){
                d[nx][ny] = d[a][b] + 1;
                que[r++] = nx*1000 + ny;
            }
        }
    }
    int res = 0;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            res = max(res, d[i][j]);
        }
    }
    return res;
}

main(){
    scanf("%d%d", &h, &w);
    for(int i=0; i<h; i++){
        scanf("%s", s[i]);
    }
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            int tmp = meiro(i, j);
            ans = max(ans, tmp);
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
//HOW YOU DOI'N........................JT
//Could this code be more bad..........CB
//I know...............................MG
//Hii..................................RG
//Noooooooo............................RG
//I wish I could but I don't want to...PB

//That's what she said.................MS


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (ll i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vvl vector<vector<ll>>
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007; // 998244353;

ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll min(ll a,ll b){if(a>=b)return b;return a;}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}

#define MAX_SIZE 100005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
			for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
	for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}


vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};


// Lets start ...

    

int main(){
    //vector<int> primes;
    //Sieve(primes);
    
    fast
    ll tests=1,cnt=0;
    //cin>>tests;
    while(tests--){
        ll n;
        cin>>n;
        ll l[n];
        fi(i,0,n)cin>>l[i];
        ll x=l[0];
        ll ans=0;
        fi(i,1,n){
            if(l[i]>=x)x=l[i];
            else ans+=(x-l[i]);
        }
        cout<<ans;
        
    }

    return 0;
    }

// Done:)




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

using namespace std;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	int n, k, S;
	cin >> n >> k >> S;
	if (S + 1 <= (int) 1e9) {
		for (int i = 0; i < k; i++) cout << S << ' ';
		for (int i = k; i < n; i++) cout << S + 1 << ' ';
		cout << '\n';
	}
	else {
		for (int i = 0; i < k; i++) cout << S << ' ';
		for (int i = k; i < n; i++) cout << 1 << ' ';
		cout << '\n';
	}
}


Measured memory_bytes: 1280
package main

import (
	"bufio"
	"bytes"
	"fmt"
	"os"
	"strconv"
)

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
)

var (
	sc = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func reverse(s string) string {
	rs := []rune(s)
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		rs[i], rs[j] = rs[j], rs[i]
	}
	return string(rs)
}

func main() {
	str := getString()
	q := getInt()

	rev := false
	var first bytes.Buffer
	var last bytes.Buffer
	for i := 0; i < q; i++ {
		t := getInt()
		if t == 1 {
			rev = !rev
		} else if t == 2 {
			f, c := getInt(), getString()
			if (f == 1 && !rev) || (f == 2 && rev) {
				first.WriteString(c)
			} else if (f == 2 && !rev) || (f == 1 && rev) {
				last.WriteString(c)
			}
		}
	}

	var ans string
	if rev {
		ans = reverse(last.String()) + reverse(str) + first.String()
	} else {
		ans = reverse(first.String()) + str + last.String()
	}
	fmt.Println(ans)
}


Measured memory_bytes: 4224
// https://atcoder.jp/contests/dp/tasks/dp_h

#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <algorithm>
#include <iomanip>

using namespace std;

long long helper(const vector<vector<char>>& g, vector<vector<long long>>& dp, int x, int y, int w, int h) {
	if (x >= w || y >= h) return 0;
	if (x == w - 1 && y == h - 1) return 1;
	if (g[y][x] == '#') return 0;
	if (dp[y][x] >= 0) return dp[y][x];
	return dp[y][x] = (helper(g, dp, x + 1, y, w, h) + helper(g, dp, x, y + 1, w, h)) % 1000000007;
}

int main (int argc, char* argv[]) {
	long long h, w;
	cin >> h >> w;

	vector<vector<char>> g(h, vector<char>(w));
	for (long long y = 0; y < h; y++) {
		for (long long x = 0; x < w; x++) {
			cin >> g[y][x];
		}
	}

	vector<vector<long long>> dp(h, vector<long long>(w, -1));
	cout << helper(g, dp, 0, 0, w, h) << endl;
}


Measured memory_bytes: 9216
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main()
{
	string s;
	cin >> s;
	cout << s[0] << s[1] << s[2] << s[3] << " " << s[4] << s[5] << s[6] << s[7] << s[8] << s[9] << s[10] << s[11] << endl;
	return 0;
}
/*
死のマウス
.　　あり許せん！
　　　∧＿＿∧
　|| （＃｀Д´ ） ||
　|| ( |　 　| | |||
　从| |　 　| |从从
￣) ⊂ノ￣￣!_つ￣て
　フヘ(　　　　ヽヘ(＼

*/

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;

int main()
{
    int a,b;
	cin>>a>>b;
	if(a==b)puts("Yes");
	else puts("No");
    return 0;
}


Measured memory_bytes: 256