akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<int>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000

int main(void) {
	int n; cin >> n;
	int r=0, w=0;
	string s; cin >> s;
	rep(i, n) {
		if (s[i] == 'R') {
			r++;
		}
		else {
			w++;
		}
	}
	int ans = 0;
	rep(i, r) {
		if (s[i] == 'W') {
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3752
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	int A1,A2;
	cin >> A1 >> A2;
	int B1,B2;
	cin >> B1 >> B2;
	if( A2 <= B1 || B2 <= A1 ){
		cout << 0 << endl;
		return;
	}
	int res = 0;
	if( B1 < A2 ){
		res = A2 - max(A1,B1);
	}else if(A1 < B2){
		res = B2 - max(A1,B1);
	}
	int ans = min(A2,B2)-max(A1,B1);
	if( ans < 0 ){
		cout << 0 << endl;
	}else{
		cout << ans << endl;
	}
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

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

  vector<vector<ll> > dp(s.size() + 1, vector<ll>(2));
  dp[0][0] = 1;  // dp[i桁目まで][L未満か]

  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '1') {
      dp[i + 1][1] = ((dp[i + 1][1] + dp[i][1] * 3 % MOD) % MOD + dp[i][0]) % MOD;
      dp[i + 1][0] = (dp[i + 1][0] + dp[i][0] * 2 % MOD) % MOD;
    }
    if (s[i] == '0') {
      dp[i + 1][1] = (dp[i + 1][1] + dp[i][1] * 3 % MOD) % MOD;
      dp[i + 1][0] = (dp[i + 1][0] + dp[i][0]) % MOD;
    }
  }
  cout << (dp[s.size()][0] + dp[s.size()][1]) % MOD << endl;
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
int main(){
  int64_t ans=1;
  int m,j,k,y,mod=1e9+7;
  bool f;
  cin>>m;
  vector<int> p={2};
  for(j=3;j<=m;j+=2){
    f=true;
    for(k=0;k<(int)p.size();k++){
      if(j%p.at(k)==0){
        f=false;
        break;
      }
    }
    if(f==true) p.push_back(j);
  }
  int l=p.size();
  vector<int> x(l);
  for(j=2;j<=m;j++){
    y=j;
    for(k=0;k<l;k++){
      while(y%p.at(k)==0){
        x.at(k)++;
        y/=p.at(k);
      }
      if(y==1) break;
    }
  }
  for(auto z:x) ans=ans*(z+1)%mod;
  cout<<ans<<endl;
}

Measured memory_bytes: 3616
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
# INF =  float("inf")
INF = 10**18
import bisect
import statistics
mod = 10**9+7
# mod = 998244353

N, M = map(int, input().split())
A = list(map(lambda x: -x, list(map(int, input().split()))))

heapq.heapify(A)

for i in range(M):
    a = -heapq.heappop(A)
    a = a // 2
    heapq.heappush(A, -a)

print(-sum(A))



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

string s,t;

int main(){
    cin >> s >> t;
    vector<int> ss(s.size(), 0), tt(t.size(), 0);
    for(int i = 0; i < s.size(); i++)ss[i] = (int)s[i];
    sort(ss.begin(), ss.end());
    for (int i = 0; i < t.size(); i++)tt[i] = (int)t[i];
    sort(tt.begin(), tt.end(), greater<int>());
    /*
    for (int i = 0; i < s.size(); i++)
        s[i] = (char)ss[i];
    for (int i = 0; i < t.size(); i++)
        t[i] = (char)tt[i];
    cout << s << endl;
    cout << t << endl;
    */
    int max = 0;
    bool flag = (s.size() >= t.size());
    if(flag){
        max = t.size();
    }else{
        max = s.size();
    }
    for(int i = 0; i < max; i++){
        if(ss[i] < tt[i]){
            cout << "Yes" << endl;
            return 0;
        }else if(ss[i] > tt[i]){
            cout << "No" << endl;
            return 0;
         }
    }
    if(flag){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cstdlib>

using namespace std;
#define INF 0x3f3f3f3f
int N,t[50],dis[50],dp[50][4];//0 go back 1,2 next

void readdata()
{
	dis[0]=t[0]=0;
	for(int i=1;i<=N;i++)
		scanf("%d%d",&dis[i],&t[i]);
}
void Dynamic_Planning()
{
	memset(dp,0x3f,sizeof(dp));

	dp[0][3]=0;
	for(int i=1;i<=N;i++)
	{
		if(dp[i-1][3]!=INF && t[i-1]+dis[i-1]*4+dis[i]<=t[i]) dp[i][1]=dis[i]+dis[i-1]+dp[i-1][3];
		for(int j=2;j<=3;j++)
		{
			if(dp[i-1][j-1]!=INF && t[i-1]+abs(dis[i-1]-dis[i])*j<=t[i])
				dp[i][j]=dp[i-1][j-1]+abs(dis[i-1]-dis[i]);
			if(dp[i-1][j-1]!=INF && t[i-1]+dis[i-1]*j+dis[i]<=t[i])
				dp[i][1]=min(dp[i][1],dp[i-1][j-1]+dis[i-1]+dis[i]);
		}
		bool flag=0;
		for(int j=1;j<=3;j++) if(dp[i][j]!=INF) flag=1;
		if(!flag)
		{
			printf("NG %d\n",i);
			return;
		}
	}
	printf("OK %d\n",min(min(dp[N][1],dp[N][2]),dp[N][3])+dis[N]);
}
int main()
{
	
	while(scanf("%d",&N)==1)
	{
		if(N==0) break;
		readdata();
		Dynamic_Planning();
	}

	return 0;
}

Measured memory_bytes: 1028
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }


int N, K, x[210];

int main()
{
  while (cin >> N >> K) {
    for (int i = 0; i < N; ++i) cin >> x[i];
    int res = 0;
    for (int i = 0; i < N; ++i) {
      res += min(x[i], K-x[i]);
    }
    cout << res*2 << endl;
  }
}
















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

signed main(){
    int n, m, l;
    cin >> n >> m >> l;
    vector<vector<int>> A(n, vector<int>(m));
    vector<vector<int>> B(m, vector<int>(l));
    vector<vector<int>> C(n, vector<int>(l));
    for (int i = 0; i < n; i++){
        for (int j = 0; j < m; j++){
            cin >> A[i][j];
        }
    }
    for (int i = 0; i < m; i++){
        for (int j = 0; j < l; j++){
            cin >> B[i][j];
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < l; j++){
            int sum = 0;
            for (int k = 0; k < m; k++){
                sum += A[i][k] * B[k][j];
            }
            C[i][j] = sum;
        }
    }
    for (int i = 0; i < n; i++){
        for (int j = 0; j < l - 1; j++){
            cout << C[i][j] << " ";
        }
        cout << C[i][l-1] << endl;
    }
    return 0;
}


Measured memory_bytes: 3204
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 ll INF=1e9+7;

int main(){
    vector<ll> p(101);
    ll x,n;
    cin >> x >> n;
    rep(i,n){
        ll v;
        cin >> v;
        p[v]=1;
    }
    ll ans=-1;
    ll diff=INF;
    for(ll i=-100;i<=200;i++){
        if(i<0 || i>100 ||  p[i]==0){
            if(abs(i-x)<diff){
                diff=abs(i-x);
                ans=i;
            }
        }
    }
    cout << ans << endl;
    return 0;
} 

Measured memory_bytes: 3632
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-11-7 21:18:03
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main()
{
  string S;
  cin >> S;
  sort(S.begin(), S.end());
  if (S == "abc")
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
#include <stack>
#include <cassert>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef vector<string> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<ll, ll> PL;
typedef vector<PL> vpl;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e17;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define RFOR(i, a, b) for(ll i = (a); i > b; i--)
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, n) for(ll i = n-1; i > -1; i--)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back
#define epb emplace_back
#define ALL(X) (X).begin(),(X).end()

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}

inline ll popcnt(ll x){return __builtin_popcountll((unsigned long long)x);};
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }


bool ok(ll s){
    return s%2 == 0 || s%3 == 0 || s%5 == 0;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll N; cin >> N; ll NN = N;
    if(N == 3){
        cout << "2 5 63" << endstr; return 0;
    }
    vl ans;
    ll idx = 2; ll sum = 0;
    while (NN>2) {
        if(ok(idx)){
            ans.pb(idx); NN--; sum += idx;
        }
        idx++;
    }
    if(sum%2 == 0){
        idx = idx/2 * 2 + 2;
        ans.pb(idx); sum += idx;
    }
    else{
        idx = idx/3 * 3 + 3;
        if(idx%2 == 0) idx+=3;
        ans.pb(idx); sum += idx;
    }
    ll b = 30;
    ll tot = (idx+sum+b-1)/b*b+b;
    ans.push_back(tot-sum);
    rep(i, N) cout << ans[i] << " ";
    cout << endstr;
//    rep(i, N){
//        if(gcd(ans[i], tot-ans[i]) == 1){
//            cerr << "Fail " << ans[i] << " " << tot - ans[i] << endstr;
//        }
//    }
    return 0;
}


Measured memory_bytes: 640
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

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

    static class ABC094_D {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = in.nextLong();
            }

            Arrays.sort(a);
            long max = a[n - 1];
            long ideal = max / 2 + max % 2;
            long min = 0;
            for (int i = 0; i < n; i++) {
                if (Math.abs(ideal - a[i]) < Math.abs(ideal - min)) {
                    min = a[i];
                }
            }

            out.println(max + " " + min);
        }

    }
}



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

int main() {
  
  while (true) {
    
    string S; cin >> S; int sum = 0;
    
    if (S == "0") break;
    
    for (int i = 0; i < S.size(); i++) {
      string digit = S.substr(i, 1);
      sum += stoi(digit);
    }
    
    cout << sum << endl;
    
  }
  
}


Measured memory_bytes: 3212
N,K=map(int,input().split())

sunuke_list=[i+1 for i in range(N)]

for i in range(K):
    d=int(input())
    a=list(map(int,input().split()))
    b=set(sunuke_list)-set(a)
    sunuke_list=list(b)
    
print(len(sunuke_list))

Measured memory_bytes: 9128
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long dp[500005];
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	dp[0]=1;
	dp[1]=m-n;
	for (int i=2;i<=n;i++)
	dp[i]=((m+i-n-1)*dp[i-1]+(i-1)*dp[i-2])%mod;
	for (int i=m-n+1;i<=m;i++)
	dp[n]=(dp[n]*i)%mod;
	printf("%lld",dp[n]);
}

Measured memory_bytes: 7504
x1,y1,x2,y2 = gets.chomp.split(" ").map(&:to_i)
deltax = x2-x1
deltay = y2-y1
x3 = x2 - deltay
y3 = y2 + deltax
x4 = x1 - deltay
y4 = y1 + deltax
puts "#{x3} #{y3} #{x4} #{y4}"

Measured memory_bytes: 14300
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
#define eps 1e-8
using namespace std;
const ll maxn = 1e6 + 5;
ll a,b,c,d,k,n,m,t,num[maxn];
string str;
int main()
{
    cin >> a >> b >> c;
    swap(a,b);
    swap(a,c);
    cout << a << " " << b << " " << c << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

  vector<double> p(N + 1, 0.0);
  for (int i = 1; i <= N; i++) {
    cin >> p.at(i);
  }

  vector<vector<double>> dp(N + 1, vector<double>(N + 1, 0.0));
  dp.at(1).at(0) = 1 - p.at(1);
  dp.at(1).at(1) = p.at(1);

  for (int i = 2; i <= N; i++) {
    dp.at(i).at(0) = dp.at(i - 1).at(0) * (1 - p.at(i));
    for (int j = 1; j <= N; j++) {
      dp.at(i).at(j) = dp.at(i - 1).at(j - 1) * p.at(i) + dp.at(i - 1).at(j) * (1 - p.at(i));
    }
  }

  double ans = 0.0;
  for (int i = N/2 + 1; i <= N; i++) {
    ans += dp.at(N).at(i);
  }

  cout << fixed << setprecision(10) << ans << endl;

  return 0;
}

Measured memory_bytes: 70784
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vl cnt(10,0);
    rep(i,4){
        ll x;
        cin >> x;
        cnt[x]++;
    }
    if(cnt[1]&&cnt[9]&&cnt[4]&&cnt[7]){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  vector<P>table(n);
  for (int i = 0; i < n; i++) {
    int a,b;
    cin >> a >> b;
    table.at(i) = make_pair(b,a);
  }
  sort(table.begin(),table.end());
  int sum = 0;
  bool ok = true;
  for (int i = 0; i < n; i++) {
    sum += table.at(i).second;
    if (sum > table.at(i).first) {
      ok = false;
      break;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main(void){
    char str[4];
    scanf("%s",str);
    int count;
    for(int i = 0;i < 4;i++){
        for(int j = 0;j < 4;j++){
            if(i != j){
                if(str[i] == str[j]){
                    count++;
                }
            }
        }
    }

    if(count == 4){
        printf("Yes");
    } else {
        printf("No");
    }
}

Measured memory_bytes: 128
n = int(input())
data = list(map(int, input().split()))

for i in range(n):
    v = data[i]
    j = i - 1
    while j >= 0 and data[j] > v:
        data[j+1] = data[j]
        j -= 1
    data[j+1] = v
    print(" ".join(map(str, data)))

Measured memory_bytes: 7668
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define ld long double
#define pb push_back
#define sz size

/*
author: Basel
*/

using namespace std;

int a;

string s;

int main()
{
    cin >> a >> s;
    if (a<3200)cout << "red\n";
    else cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#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<bool> vb;
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())
#define MATHPI acos(-1)
#define _LIBCPP_DEBUG 0
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);};};
const int MOD = 1000000007;
const int INF = INT_MAX;
const ll LLINF = 1LL<<62;
//g++ -std=c++1z main.cpp
//.\a.exe

//xのn乗%modを計算
ll mod_pow(ll x,ll n,ll mod){
    ll res = 1;
    while(n > 0){
        if(n & 1) res = res*x%mod;
        x = x*x%mod;
        n >>= 1;
    }
    return res;
}

int main(){
///////////////////////////////////////////////////////////
int n,a=0,mod=998244353;
ll ans=1;
cin >> n;
int d[n];
for(int i=0;i<n;i++){
    cin >> d[i];
}
if(d[0]!=0){
    cout << 0 << endl;
    return 0;
}
for(int i=1;i<n;i++){
    if(d[i]==0){
        cout << 0 << endl;
        return 0;
    }
}
map<int,int> m;

for(int i=0;i<n;i++){
    m[d[i]]++;
}
for(int i=0;i<n;i++){
    a=max(a,d[i]);
}
for(int i=0;i<a;i++){
    ans=ans*mod_pow((ll)m[i],(ll)m[i+1],mod)%mod;
}
cout << ans << endl;
//////////////////////////////////////////////////////////
}

Measured memory_bytes: 5376
#2019/09/15 300点，ぎり間に合わず 悔しい

'''
import numpy as np
def python_list_sub(in1, in2):
    wrk = np.array(in1) + np.array(in2)
    return wrk.tolist()
'''


n, k, q = map(int,input().split())
Po = []
#De = [1 for i in range(n)]

A = [int(input()) for i in range(q)]
#print(A)

# はじめからポイント減らしておく:ここが味噌
for i in range(n):
    Po.append(int(k-q))
#print(Po)
# 入力OK

#計算，正解者だけ足していく
for j in A:
    #print(j,A[j])
    Po[j-1] += 1
#print(Po)

for i in range(n):
    if Po[i] >0:
        print('Yes')
    else: print('No')

Measured memory_bytes: 11776
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <set>
#include <cmath>
using namespace std;
//const int maxn=;
typedef long long ll;
ll a,b;
int main(){
	cin>>a>>b;
	cout<<a*b/__gcd(a,b)<<endl;
}

Measured memory_bytes: 256
import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static char c;
	public static void main(String[] args) throws Exception {
		int k=sc.nextInt();
		int max=sc.nextInt();
		int[] arr=new int[k];
		Map<Integer,Integer> m=new HashMap<Integer,Integer>();
		for(int i=0;i<arr.length;i++){
			int number=sc.nextInt();
			int count=m.getOrDefault(number, 0);
			m.put(number, count+1);
		}
		List<int[]> list=new ArrayList<int[]>();
		for(int i:m.keySet())
			list.add(new int[]{i,m.get(i)});
		Collections.sort(list,((i1,i2)->(i1[1]-i2[1])));
		int count=0;
		for(int i=0;i<list.size()-max;i++){
			count+=list.get(i)[1];
		}
		System.out.println(count);
		
		
		
	}

}

Measured memory_bytes: 101592
#include <stdio.h>

int main(void){
	int a,b,c,i;
	do{
		scanf("%d %d %d",&a,&b,&c);
	}while(a<1 || a>10000 || b<1 || b>10000 || c<1 || c>10000);

	for(i=1;i<=10000;i++){
		if(i==a){
			printf("%d",a);
			if(a<b || a<c)
				putchar(' ');
		}
		if(i==b){
			printf("%d",b);
			if(b<a || b<c)
				putchar(' ');
		}
		if(i==c){
			printf("%d",c);
			if(c<a || c<b)
				putchar(' ');
		}
	}
	putchar('\n');

	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <string>
#include <limits>
#include <algorithm>
#include <map>
#include <sstream>
#include <unordered_map>
#include <set>

using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
static ull tenq = 1000000000;
static ull mod = tenq + 7;

using namespace std;

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


  cout << min(C, B/A) << endl;

  return 0;
}


Measured memory_bytes: 888
import sys
args = sys.stdin.readlines()
N = int(args[0])
d = {}
for i, line in enumerate(args[1:]):
  S, p = line.split(' ')
  P = int(p)
  if S in d:
    d[S].append((i+1, P))
  else:
    d[S] = []
    d[S].append((i+1, P))
    
for key in sorted(d.keys()):
    d[key].sort(key=lambda x:x[1], reverse=True)
    for (i, p) in d[key]:
        print(i)


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

int main(){
  int64_t N, D;
  cin >> N >> D;
  int64_t ans = 0;
  for(int i=0; i<N; i++){
    int64_t x, y;
    cin >> x >> y;
    if(D*D>=x*x+y*y){
      ans++;
    }
  }
  cout << ans << endl;
}


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

using namespace std;

const int MAX = 5100000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
  long long int X, Y, n, m;
  long long ans;
  cin >> X >> Y;
  COMinit();
  if((2*X-Y)%3 == 0 && (2*X-Y)>=0 && (2*Y-X)>=0){
    n = (2*X - Y)/3; m = (2*Y - X)/3;
    ans = COM(n+m, n);
  }else{
    ans = 0;
  }

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


Measured memory_bytes: 119808
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define Sort(a) sort(a.begin(), a.end())
#define Reve(a) reverse(a.begin(), a.end())
typedef long long ll;
const ll MOD = 1e9+7;


int main(){
  int n; cin >> n;
  int64_t k; cin >> k;
  vector<pair<int64_t, int64_t>> A(n);
  rep(i, n) cin >> A[i].first >> A[i].second;
  Sort(A);
  rep(i, n){
    if(A[i].second>=k) {
      cout << A[i].first << endl;
      break;
    }
    else k -= A[i].second;
  }
  
}


Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <list>
#include <vector>
using namespace std;
typedef long long li;
#define MOD 1000000007
#define rep(i, n) for (int i = 0; i < (n); i++)
#define df 0
template <class T>
void print(const T& t) {
    cout << t << "\n";
}
template <class T, class... Ts>
void print(const T& t, const Ts&... ts) {
    cout << t;
    if (sizeof...(ts)) cout << " ";
    print(ts...);
}

void dfs(vector<vector<int>>& adj, vector<int>& ans, const vector<li>& a, int parent = -1,
         int v = 0) {
    static vector<li> lis;
    lis.reserve(adj.size());

    auto itr = lower_bound(lis.begin(), lis.end(), a[v]);
    int flag = (itr != lis.end());
    li memo;
    if (flag) {
        memo = *itr;
        *itr = a[v];
    } else
        lis.push_back(a[v]);

    ans[v] = lis.size();
    for (int x : adj[v]) {
        if (x == parent) continue;
        dfs(adj, ans, a, v, x);
    }

    if (flag)
        *itr = memo;
    else
        lis.pop_back();
}

int main() {
    int n;
    cin >> n;
    vector<li> a(n);
    rep(i, n) cin >> a[i];
    vector<vector<int>> adj(n);
    rep(i, n - 1) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    vector<int> ans(n, -1);
    dfs(adj, ans, a);

    rep(i, n) print(ans[i]);
}

Measured memory_bytes: 33816
def resolve():
    m,d=map(int, input().split())
    cnt=0
    for i in range(1,m+1):
        for j in range(22,d+1):
            jstr=str(j)
            j10=int(jstr[0])
            j1=int(jstr[1])
            if j1>=2 and j10>=2 and i==j1*j10:
                cnt+=1
    print(cnt)
resolve()

Measured memory_bytes: 3060
#include <iostream>

using namespace std;
typedef long long llong;

#define MAX 101
const llong mod = 1000000000 + 7;

int main()
{
  int N, K, d;
  int a, B[MAX];
  int ans = 0;

  cin >> N >> K;

  for (int i = 0; i < N; i++)
  {
    B[i] = 0;
  }

  for (int i = 0; i < K; i++)
  {
    cin >> d;
    for (int j = 0; j < d; j++)
    {
      cin >> a;
      B[a - 1]++;
    }
  }
  for (int i = 0; i < N; i++)
  {
    if (B[i] == 0)
      ans++;
  }

  printf("%d\n", ans);

  return 0;
}

Measured memory_bytes: 3704
#s='125'
s=input()
n=len(s)

ans=0
for bit in range(1<<(n-1)):
    f=s[0]
    for i in range(n-1):
        if bit&(1<<i):
            f+="+"
        f+=s[i+1]
    ans+=sum(map(int,f.split("+")))

print(ans)

Measured memory_bytes: 3060
def main():
    grid = [list(map(int, input().split())) for _ in range(3)]

    if grid[0][0] == (grid[0][2] + grid[2][0]) - grid[2][2] and grid[1][1] == (grid[0][1] + grid[1][0]) - grid[0][0] and grid[2][2] == (grid[1][2]+grid[2][1]) - grid[1][1]:
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 8976
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define vlli vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vplli vector< pair< ll,ll> >
#define plli pair< ll,ll >
#define vps vector< pair< string, string> >
#define vpi vector< pair< int, int> >
#define all(x) x.begin(), x.end()
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define forn(i,a,n) for(ll i=a;i<n;i++)
#define scan(arr,a,n) for(ll i=(a);i<(n);i++)cin>>(arr)[i];
#define print(arr,a,n) for(ll i=(a);i<(n);i++)cout<<(arr)[i]<<" ";

ll add(ll x, ll y) {ll res = x + y; return (res >= mod ? res - mod : res);}
ll mul(ll x, ll y) {ll res = x * y; return (res >= mod ? res % mod : res);}
ll sub(ll x, ll y) {ll res = x - y; return (res < 0 ? res + mod : res);}
ll power(ll x, ll y) {ll res = 1; x %= mod; while (y) {if (y & 1)res = mul(res, x); y >>= 1; x = mul(x, x);} return res;}
ll mod_inv(ll x) {return power(x, mod - 2);}


int main(){
	fast;
    #ifndef ONLINE_JUDGE
    freopen("input1.txt","r",stdin);
    freopen("output1.txt","w",stdout);
    #endif
	long double n, m, x;
	cin>>n>>m>>x;
	cout<<(ll)ceil(x/max(n, m));
}

Measured memory_bytes: 3688
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n,k,w[100005];
bool pack(int p)
{
    int take=0,cars=0;
    for(int i=0;i<n;i++)
    {
        if(p<w[i])return true;
        if(take+w[i]<=p)take+=w[i];
        else
        {
            cars++;
            take=0;
            i--;
        }
    }
    if(take)cars++;
    return cars>k;
}
int main()
{
    cin>>n>>k;
    for(int i=0;i<n;i++)scanf("%d",&w[i]);
    int l=0,r=1e9+5,m;
    while(l<r)
    {
        m=(l+r)/2;
        if(pack(m))l=m+1;
        else r=m;
    }
    cout<<l<<endl;
    return 0;
}


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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a + b > c + d) cout << "Left" << endl;
    else if(a + b < c + d) cout << "Right" << endl;
    else cout << "Balanced" << endl;
}

Measured memory_bytes: 256
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

c = Counter(a)
key = c.keys()
comb = 0
for i in key:
    comb += (c[i]) * (c[i]-1) // 2 #禁止されていない状態の組み合わせを調べる

for i in a:
    ans = comb - (c[i]-1) #a[i]が禁止されている状態の組み合わせ
    print(ans)


Measured memory_bytes: 26780
#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; i++)
int main()
{
   int n;
   cin >> n;
   int a[4];

   for (int i = 3; i >= 0; i--)
   {
      a[i] = n % 10;
      n /= 10;
   }
   if ((a[0] == a[1] && a[1] == a[2]) || (a[1] == a[2] && a[2] == a[3]))
   {
      cout << "Yes" << endl;
   }
   else
   {
      cout << "No" << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int inf=1e9+7;
int m;
string last="@";
vector<string> used;
bool find(string t)
{
	for(int i=0;i<(int)used.size();i++)
	if(used[i]==t) return true;
	return false;
}
int main()
{
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>m;
	while(m--)
	{
		string s;
		cin>>s;
		if(find(s) || (last[0]!='@' && s[0]!=last[(int)last.size()-1]))
		{
			cout<<"No"<<endl;
			return 0;
		}
		used.push_back(s);
		last=s;
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void run (void) {
  i32 a, b, c;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &a, &b, &c);
  i32 d = a % 2 + b % 2 + c % 2;
  puts (d >= 2 ? "Hom" : "Tem");
}

int main (void) {
  run();
  return 0;
}



Measured memory_bytes: 2108
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<(int)(n);i++)
#define N 200000

int main(){
	int a[10];
	f(i, 10)a[i] = 0;
	int x, y, z,w;
	scanf("%d %d %d %d", &x, &y, &z, &w);
	a[w]++;
	a[x]++;
	a[y]++;
	a[z]++;
	if(a[1]==1&&a[9]==1&&a[7]==1&&a[4]==1)printf("YES\n");
	else printf("NO\n");


	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in);) {
            solve(sc);
        }
    }

    public static void solve(Scanner sc) {
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b <= a) {
            System.out.println("delicious");
            return;
        }

        if (x >= b - a) {
            System.out.println("safe");
            return;
        }

        System.out.println("dangerous");
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using in6 = int64_t;
using ind = double;
using vi = vector<in6>;
using vii = vector<vi>;
using vs = vector<string>;
using pii = pair<in6,in6>;
using psi = pair<string,in6>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

int main() {
  kyun;
  in6 n,m,x;
  cin >> n >> m >> x;
  vii data(n,vi(m+1));
  rep(i,n) {
    rep(j,m+1) {
      cin >> data[i][j];
    }
  }
  bool check = 0;
  in6 ans = inf;
  rep(i,1<<n) {
    vi test(m+1);
    rep(j,n) {
      if(i & 1<<j) {
        rep(k,m+1) test[k] += data[j][k];
      }
    }
    bool under = 1;
    repa(j,1,m+1) {
      if(test[j] < x) under = 0;
    }
    if(under) {
      ans = min(ans,test[0]);
      check = 1;
    }
  }
  if(check) cout << ans;
  else cout << -1;
  hinata;
}

Measured memory_bytes: 3644
using System;
using System.Collections;

public class p0100
{
	p0100 ()
	{
		string str;
		string[] st;
		int n, p;
		bool f;
		ArrayList al = new ArrayList ();
		decimal[] sm = new decimal[4001];
		
		while ((str=Console.ReadLine())!=null && str != "0") {
			n = int.Parse (str);
			f = true;
			for (int i = 0; i < 4001; ++i)
				sm [i] = 0;
			
			while (0 < n--) {
				st = (Console.ReadLine ()).Split (' ');
				p = int.Parse (st [0]);
				
				sm [p] += decimal.Parse (st [1]) * decimal.Parse (st [2]);
				if (!al.Contains (p))
					al.Add (p);
			}
			
			foreach (int i in al)
				if (sm [i] >= 1000000) {
					Console.WriteLine ("{0}", i);
					f = false;
				}
			if (f)
				Console.WriteLine ("NA");
			al.Clear();
		}
	}
	
	public static int Main(string[] args){
		new p0100();
		return 0;
	}
}

Measured memory_bytes: 6268
import sys
input = sys.stdin.readline

def linput():
    return [int(x) for x in input().split()]

n = int(input())
s = input().rstrip()

from collections import Counter

r = [0] * (n + 1)
g = [0] * (n + 1)
b = [0] * (n + 1)



for i in range(1, n + 1):
    if s[i - 1] == "R":
        r[i] = r[i - 1] + 1
    else:
        r[i] = r[i - 1]
    if s[i - 1] == "G":
        g[i] = g[i - 1] + 1
    else:
        g[i] = g[i - 1]
    if s[i - 1] == "B":
        b[i] = b[i - 1] + 1
    else:
        b[i] = b[i - 1]

ans = 0
for i in range(n):
    for j in range(i + 1, n - 1):
        if s[i] == s[j]:
            continue
        ng = j + (j - i) + 1
        if s[i] == "R" and s[j] == "G":
            l = b
        elif s[i] == "R" and s[j] == "B":
            l = g
            #c = cg
        elif s[i] == "G" and s[j] == "R":
            l = b
            #c = cb
        elif s[i] == "G" and s[j] == "B":
            l = r
            #c = cr
        elif s[i] == "B" and s[j] == "R":
            l = g
            #c = cg
        elif s[i] == "B" and s[j] == "G":
            l = r
            #c = cr
        ans += l[n] - l[j + 1]
        if ng < n + 1:
            ans -= l[ng] - l[ng - 1]
        #print(ans)

print(ans)






Measured memory_bytes: 69208
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
int main(){
	fast;
	ll t,n; cin>>n;
	string s; 
	while(n){
		n--;
		s+=char('a'+n%26);
		n/=26;
	}
	reverse(s.begin(), s.end());
	cout<<s<<'\n';
	return 0;
}

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

using namespace std;

main(){
    int n;
    scanf("%d",&n);
    vector<int> arr (n);
    for(int i=0;i<n;++i) scanf("%d",&arr[i]);
    sort(arr.begin(),arr.end());
    int maxi=0;
    for(int i=0;i<n;++i){
        int count = 1;
        for(int j=i+1;j<n;++j){
            if(abs(arr[i]-arr[j])<=2) count++;
            else break;
        }
        maxi = max(maxi,count);
        if(count>=n-i) break;
    }
    printf("%d\n",maxi);
}


Measured memory_bytes: 640
<?php
$ary = array_fill(1, 100, 0);
$cnt = 0;
while (fscanf(STDIN, '%d', $a)) {
    if (is_null($a)) {
        break;
    }
    $ary[$a]++;
    $a = null;
}
$max = max($ary);
foreach ($ary as $n => $m) {
    if ($m === $max) {
        echo $n, PHP_EOL;
    }
}


Measured memory_bytes: 9264
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val s = (1..3).map { sc.next() }

    var ans = 0
    repeat(n) {
        ans += setOf(s[0][it], s[1][it], s[2][it]).size - 1
    }
    println(ans)
}

Measured memory_bytes: 35920
#include <iostream>
#include <vector>
using namespace std;
int main()
{
    long long a, b, c;
    cin >> a >> b >> c;
    if (c - a - b <= 0)
    {
        cout << "No" << endl;
        return 0;
    }
    bool ok = (a * a  + b * b + c * c - 2 * (a + b) * c - 2 * a * b) > 0;
    if (ok)
    {
        cout << "Yes" << endl;
        return 0;
    }
    else
    {
        cout << "No" << endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=list(map(int,input().split()))
l=[0,2,5,5,4,5,6,3,7,6]
dp=[0]+[-1]*(9*n)
for i in range(n):
  for j in a:
    if dp[i]>=0:
      dp[i+l[j]]=max(dp[i+l[j]],dp[i]*10+j)
print(dp[n])

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

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

    int ssum=accumulate(s.begin(),s.end(),0);
    
    vector<vector<int>> dp(N+1,vector<int>(ssum+1));
    for (int j = 0; j < ssum+1; j++){
        dp.at(0).at(j)=0;
    }

    for (int i = 0; i < N; i++){
        for (int j = 0; j < ssum+1; j++){
            if(j-s.at(i)>=0){
                dp.at(i+1).at(j)=max(dp.at(i).at(j-s.at(i))+s.at(i),dp.at(i).at(j));
            }
            else{
                dp.at(i+1).at(j)=dp.at(i).at(j);
            }
        }
    }

    int ans=dp.at(N).at(ssum);
    for (int i = 1; i < ssum; i++){
        if(ans%10!=0 || ans==0){
            break;
        }
        ans=dp.at(N).at(ssum-i);
    }

    cout << ans << endl;

          
}

Measured memory_bytes: 7040
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
struct node
{
	string str;
}s[105];
bool cmp(node a,node b)
{
	return a.str<b.str;
}
int main()
{
	
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		cin>>s[i].str;
	}
	sort(s,s+n,cmp);
	for(int i=0;i<n;i++)
	{
		cout<<s[i].str;
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var aL = "abcdefghijklmnopqrstuvwxyz";
        var s = Console.ReadLine().Trim();
        var ret = 999999999;
        for (int i = 0; i < aL.Length; i++)
            ret = Math.Min(ret, getChange(s, aL[i]));
        Console.WriteLine(ret);
    }
    public static int getChange(string s, char c)
    {
        var ret = 0;
        while (true)
        {
            var cc = s.Replace(c.ToString(), "").Length;
            if (cc == 0) return ret;
            var ns = "";
            for (int i = 0; i < s.Length - 1; i++)
                if (s[i] == c | s[i + 1] == c) ns += c;
                else ns += s[i];
            ret++;
            s = ns;
        }
    }
}


Measured memory_bytes: 15308
#include<stdio.h>

int selectionSort(int A[],int N){
  int i,j,t,sw=0,minj;
  for(i=0;i<N-1;i++){
    minj=i;
    for(j=i;j<N;j++){
      if(A[j]<A[minj])minj=j;
    }
    t=A[i];A[i]=A[minj];A[minj]=t;
    if(i!=minj)sw++;
  }
  return sw;
}

int main(){
  int A[100],N,i,sw;

  scanf("%d",&N);
  for(i=0;i<N;i++)scanf("%d",&A[i]);

  sw=selectionSort(A,N);

  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",sw);

  return 0;
}

Measured memory_bytes: 2708
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

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 ll mod=1e9+7;

int main()
{
    ll n,m;
    cin >> n >> m;
    vector<ll> a(n);
    rep(i,n){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    vector<pll> b(m);
    rep(i,m){
        cin >> b[i].se >> b[i].fi;
    }
    sort(b.rbegin(),b.rend());
    ll num=0;
    ll sum=0;
    rep(i,n){
        if(a[i]>=b[num].fi){
            sum+=a[i];
        }
        else{
            b[num].se--;
            sum+=b[num].fi;
        }
        if(b[num].se==0 && num<m-1){
            num++;
        }
        else if(b[num].se==0 && num==m-1){
            for(ll j=i+1;j<n;j++){
                sum+=a[j];
            }
            break;
        }
    }
    cout << sum << endl;
    return 0;
} 

Measured memory_bytes: 2560
#include "bits/stdc++.h"
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
	int n;
	vector<T> d;
	BIT(int n = 0) :n(n), d(n + 1) {}
	void add(int i, T x = 1) {
		for (i++; i <= n; i += i & -i) {
			d[i] += x;
		}
	}
	T sum(int i) {
		T x = 0;
		for (i++; i; i -= i & -i) {
			x += d[i];
		}
		return x;
	}
	T sum(int l, int r) {
		return sum(r - 1) - sum(l - 1);
	}
};

int main() {
	int N, Q;
	cin >> N >> Q;
	BIT<long long> d(N);
	for (int i = 0; i < N; ++i) {
		long long num;
		cin >> num;
		d.add(i, num);
	}
	for (int i = 0; i < Q; ++i) {
		long long x, y, z;
		cin >> x >> y >> z;
		if (1 == x) {
			if (0 == y) {
				cout << d.sum(z - 1) << endl;
			}
			else {
				cout << d.sum(z - 1) - d.sum(y - 1) << endl;
			}
		}
		else {
			d.add(y, z);
		}
	}
	return 0;
}


Measured memory_bytes: 8216
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int a[10];
int ans=-INF;
int b[110][11];
int c[110][11];
int n;
void func(){
    int cnt=0;
    for(int i=0;i<10;i++){
        if(a[i]==1){
            cnt+=1;
            break;
        }
    }   
    if(cnt==0)return;
    int score=0;
    int cnt1=0;
    for(int i=0;i<n;i++){
        cnt1=0;
        for(int j=0;j<10;j++){
            if(a[j]==1 && b[i][j]==1){  
             cnt1+=1; 
        
    }
        }
    score+=c[i][cnt1];
        
    }
    ans=max(ans,score);

}
void dfs(int pos){
    if (pos==10){
        func();
        return;
    }
    a[pos]=0;
    dfs(pos+1);
    a[pos]=1;
    dfs(pos+1);

}

int main() {
    
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<10;j++){
            cin>>b[i][j];
        }
    }
for(int i=0;i<n;i++){
        for(int j=0;j<=10;j++){
            cin>>c[i][j];
        }
    }
dfs(0);
cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 764