akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
/*#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>
*/
#define int long long
#define REP(i,a,n) for(int i=a;i<n;++i)
#define rep(i,n) REP(i,0,n)
#define REV(i,a,n) for(int i=n;i>=a;--i)
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define show(n) cerr<<#n<<" = "<<n<<endl
#define showp(n) cerr<<n.fs<<", "<<n.sc<<endl
#define shows(n) for(auto z:n){cerr<<z<<", ";}cerr<<endl
#define showsp(n) for(auto z:n){cerr<<z.fs<<" "<<z.sc<<", "}cerr<<endl

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}
inline int  in(){int n;scanf("%lld",&n);return n;}
inline void out(int n){printf("%lld\n",n);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int dp[100010];
vi table;

int n;

void init(){
    fill(dp,dp+100010,INF);
    int i=6;
    table.pb(1);
    while(true){
        if(i>100000) break;
        table.pb(i);
        i*=6;
    }
    i=9;
    while(true){
        if(i>100000) break;
        table.pb(i);
        i*=9;
    }
    rep(i,table.size()) dp[table[i]]=1;
}

signed main(){
    io();

    init();
    cin>>n;
    while(true){
        if(dp[n]!=INF) break;
        REP(i,1,100001){
            rep(j,table.size()){
                if(i+table[j]>100000) continue;
                
                dp[i+table[j]]=min(dp[i]+1,dp[i+table[j]]);
            }
        }
    } 
    cout<<dp[n]<<endl;

    return 0;
}


Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func main() {
	var a int
	var profit int = -1000000000

	n := nextInt()
	min := nextInt()
	for i := 1; i < n; i++ {
		a = nextInt()
		if profit < a-min {
			profit = a - min
		}
		if min > a {
			min = a
		}
	}
	fmt.Println(profit)
}



Measured memory_bytes: 4096
x = int(input())
for diff in range(1, 250):
  a = 1
  while True:
    b = a-diff
    val = a**5 - b**5
    if val == x:
      print(a,b)
      exit(0)
    if b > 0 and  val > x:
      break
    a += 1
print(-1)

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

int main(){
    string s;    
    cin>>s;
    string ans;
    for(auto c:s){
        if(c=='B'){ 
            if(ans.size()) ans.pop_back();
        }
        else ans.push_back(c);
    } 
    cout<<ans<<endl;
    return 0;
}


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

// #define int long long // intで書いたけど心配なときにlong longに変換する
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

/* short */
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)
#define X real()
#define Y imag()

/* REPmacro */
#define REPS(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (ll i = (a); i >= (ll)(n); --i)
#define DEP(i, n) DEPS(i, n, 0)
#define EACH(i, n) for (auto&& i : n)

/* debug */
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';

/* alias */
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

/* func */
inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; cin >> x; return x;}
inline ll IN() {ll x; cin >> x; return x;}
inline vs split(const string& t, char c) {vs v; stringstream s(t); string b; while(getline(s, b, c)) v.eb(b); return v;}
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
template <typename T, typename S> inline void print(const pair<T, S>& p) {cout << p.first << " " << p.second << endl;}
template <typename T> inline void print(const T& x) {cout << x << '\n';}
template <typename T, typename S> inline void print(const vector<pair<T, S>>& v) {for (auto&& p : v) print(p);}
template <typename T> inline void print(const vector<T>& v, string s = " ") {REP(i, v.size()) cout << v[i] << (i != (ll)v.size() - 1 ? s : "\n");}


signed main() {
    ll N; cin >> N;
    vector<ll> A(N); REP(i, N) cin >> A[i];
    map<ll, ll> mp;
    REP(i, N) {
        mp[A[i]]++;
    }
    ll baseans = 0;
    ll cnt;
    REP(i, N+1) {
        cnt = mp[i];
        if(cnt>=2) {
            baseans += cnt*(cnt-1)/2;
        }
    }
    ll ans;
    REP(i, N) {
        cnt = mp[A[i]];
        if(cnt == 2) {
            ans = baseans - 1;
        } else if (cnt > 2) {
            ans = baseans - ( cnt*(cnt-1)/2 - (cnt-1)*(cnt-2)/2 );
        } else {
            ans = baseans;
        }
        print(ans);
    }

    return 0;
}

// https://github.com/kurokoji/.cpp-Template/wiki テンプレートについて
// http://www.creativ.xyz/dump-cpp-652 dump()について
// https://gist.github.com/rigibun/7905920 色々

Measured memory_bytes: 16640
///In the name of GOD
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MXN = 4e5 + 10;
ll h1, m1, h2, m2, t, ans;
string s;
int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
    cin >> s; t = s.size();
    for(int i = 0; i < t; i ++){
        if(s[i] == '?') s[i] = 'D';
    }
    cout << s << '\n';
    return 0;
}
/*!
    I CHOOSE TO HAVE FAITH,
    BECAUSE WITHOUT THAT,
    I HAVE NOTHING....
    ITS THE ONLY THING THAT'S KEEPING ME GOING.
*/
//! N.N


Measured memory_bytes: 3764
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n-1);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n-1; i++) cin >> c[i];
    
    int ans = 0;
    int beforeIndex = -1;
    for (int i = 0; i < n; i++) {
        if (a[i]-beforeIndex == 1) ans += c[beforeIndex-1];
        ans += b[a[i]-1];
        beforeIndex = a[i];
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);i--)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef pair<string,P> Q;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,p;
  cin >> n >> p;

  cout << (n*3+p)/2 << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>
   
using namespace std;

#define mod 1000000007

int root[10001];

int getroot(int n)
{
    if(root[n] == -1) return n;
    else return root[n] = getroot(root[n]);
}

void unite(int x, int y)
{
    x = getroot(x);
    y = getroot(y);
    if(x == y) return;
    if(x > y) swap(x, y);
    root[y] = x;
}

int main()
{
    int n, q;
    cin >> n >> q;
    for(int i = 0; i < n; i++){
        root[i] = -1;
    }
    for(int i = 0; i < q; i++){
        int c, x, y;
        cin >> c >> x >> y;
        if(c == 0){
            unite(x, y);
        } else {
            cout << (getroot(x) == getroot(y)) << endl;
        }
    }
    return 0;
}

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

using namespace std;

bool check(double mid, double a[], double l, int n){
	if(a[0]>mid || (l - a[n - 1])>mid) return false;

	for(int i = 0; i < n - 1; i++){
		if((a[i+1] - a[i]) > 2*mid) return false;
	}
	return true;
}
void solve(){
	int a; cin>>a;
	cout << a + (a*a) + (a*a*a) << "\n";
}

int main(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	while(t--){
		solve();
	}
	return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<random>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define int long long
#define inf 1145141919
#define mod 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
typedef pair<int, P> PP;
struct edge { int to, cost; };
int a[114], b[114];
signed main() {
	int n, m, x, y; cin >> n >> m >> x >> y;
	rep(i, n)cin >> a[i]; rep(i, m)cin >> b[i];
	sort(a, a + n);
	sort(b, b + m);

	for (int i = x + 1; i <= y; i++) {
		if (a[n - 1] < i&&i <= b[0]) {
			puts("No War");

			return 0;
		}
	}
	puts("War");
}


Measured memory_bytes: 256
n,m,l=map(int,input().split())
a=[list(map(int,input().split()))for _ in range(n)]
b=[list(map(int,input().split()))for _ in range(m)]
[print(*x)for x in[[sum(s*t for s,t in zip(c,l))for l in zip(*b)]for c in a]]

Measured memory_bytes: 7004
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  string s;cin>>s;lint i,sz;sz=s.size();
  //caricurate
  vector<vector<long long>> dp(2,vector<long long>(sz,0));
  //0:儀礼通過済 1:NO
  dp[0][0]=1;dp[1][0]=2;
  for(i=1;i<sz;i++){
    if(s.at(i) =='1'){
      dp[0][i]+=3*dp[0][i-1];
      dp[0][i]%=INF;
      dp[0][i]+=dp[1][i-1];
      dp[0][i]%=INF;
      dp[1][i]+=2*dp[1][i-1];
      dp[1][i]%=INF;
    }else{
      dp[0][i]+=3*dp[0][i-1];
      dp[0][i]%=INF;
      dp[1][i]+=dp[1][i-1];
      dp[1][i]%=INF;
    }
  }
  
  //output
  long long ans=0;
  ans+=dp[0][sz-1];ans%=INF;ans+=dp[1][sz-1];ans%=INF;
  cout<<ans<<endl;
}

Measured memory_bytes: 2896
#include<bits/stdc++.h>
using namespace std;
const int maxn=100050;
int n,l,r;
bool vis[maxn];
int main() {
	memset(vis,0,sizeof vis);
	cin>>n;
	int ans=0;
	while(n--) {
		cin>>l>>r;
		for(int i=l;i<=r;i++) {
			if(!vis[i]) {
				vis[i]=1;
				ans++;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 384
//IN THE NAME OF GOD;
//Test By Dev-C++5.11
#include<bits/stdc++.h>
#define ll  long long
#define isc ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define ld long double
#define ss string
#define ww while
#define vl vector<ll>
#define pb push_back
#define in insert
#define itr iterator
#define gt goto
#define rep(i,n,j) for(ll i=n;i<j;i++)
#define tep(i,n,j) for(ll i=n;i>=j;i--)
#define co(n) cout << n ;
#define pll pair<ll,ll>
#define bft bool f=true
#define bff bool f=false
using namespace std;

ll bmm(ll a, ll b) {
	if (b == 0) return a;
	else return bmm(b, a%b);
}
ll kmm(ll a, ll b) {
	return(a*b) / bmm(a, b);
}

const ll mod = 1e9 + 7;
const ll MAXN = 1e5+5;

ll n,a[MAXN],x=0;

int main() {
	isc;
	cin >>n;
	rep(i,0,n){
		cin >> a[i];
	}
	rep(i,0,n){
		rep(j,i+1,n){
			x+=a[i]*a[j];
		}
	}
	cout << x;
	return 0;
}



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

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string str;
    cin >> str;
    string rev = str;
    reverse(rev.begin(), rev.end());
    cout << (str == rev ? "Yes" : "No") << endl;
}


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

int gcd(int a, int b) {
	if (a%b == 0)
		return b;
	if (b%a == 0)
		return a;
	int i;
	if (a < b)
		i = a;
	else
		i = b;
	for (; i > 1; i--) {
		if (a%i == 0 && b%i == 0)
			break;
	}
	return i;
}

int main() {
	int n, X, d; cin >> n >> X;
	int *x = new int[n];
	cin >> x[0];
	d = abs(X - x[0]);
	for (int i = 1; i < n; i++) {
		cin >> x[i];
		d = gcd(d, abs(X - x[i]));
	}
	cout << d << endl;
	return 0;
}

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

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

  int max = 0;
  for(int i=0; i<n-1; i++) {
    for(int j=i+1; j<n; j++) {
      if(max < abs(a[i]-a[j])) {
        max = abs(a[i]-a[j]);
      }
    }
  }
  cout << max << endl;
  return 0;
}

Measured memory_bytes: 3528
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, h;
  cin>>h>>a;
  int i=0;
  for(i=1;;i++)
  {
    h=h-a;
    if(h<=0)
      break;
  }
  cout<<i;
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < n; ++i)
using ll = long long;
using P = pair<ll,ll>;
int main() {
   ll H,W;cin>>H>>W;
   vector<P> walls;
   set<P> end_start;
   multiset<ll> dist;
   rep(i,H){
      ll A,B;cin>>A>>B;
      A--;B--;
      walls.push_back({A,B});
   }
   rep(i,W){
      end_start.insert({i,i});
      dist.insert(0);
   }
   rep(i,H){
      P wall=walls[i];
      auto l=end_start.lower_bound({wall.first,0});
      auto r=end_start.lower_bound({wall.second+1,0});
      P best={W,0};
      ll most_right=0;
      vector<P>extr;
      for(;l!=r;l++){
         ll d=(l->first)-(l->second);
         dist.extract(d);
         P es=*l;
         extr.push_back(es);
         if(es.second>=most_right){
            es.first=wall.second+1;
            best=es;
            most_right=es.second;
         }
      }
      for (auto &&j : extr) end_start.extract(j);
      if(best.first!=W){
         end_start.insert(best);
         dist.insert(best.first-best.second);
      }
      if(dist.empty())cout<<-1<<endl;
      else cout<<((*(dist.begin()))+i+1)<<endl;
   }
}

Measured memory_bytes: 28288
// abc156_a
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N, R;
    cin >> N >> R;

    int ans;
    if (N >=10){
        ans = R;
    } else{
        ans = R + 100 * (10 - N);
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 256
// (ง •̀_•́)ง (ง •̀_•́)ง  (ง •̀_•́)ง
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <vector>
using namespace std;

const int INF = 1e9;
int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	vector<int> v(n, INF);
	for(int &x : v)
		scanf("%d", & x);
	vector<int> dp(n, INF);
	dp[0] = 0;
	for(int i = 0; i < n; ++i) {
		for(int j = 1; j <= k; ++j) {
			if(i + j < n) {
				dp[i + j] = min(dp[i + j], dp[i] + abs(v[i] - v[i + j]));
			}
		}
	}
	cout << dp[n - 1];
}


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

B = []
for i in input().split():
    B.append(int(i))

total = 0
for j in range(N):
    A = []
    for k in input().split():
        A.append(int(k))

    tmp = 0
    for l in range(M):
        tmp += B[l] * A[l]

    tmp += C
    if tmp > 0 :
        total += 1

print(total)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INF = 1e9;
const double PI = acos(-1.0);
 
int main(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
     
    while(1) {
        string x;
        cin >> x;
        if(x[0] == '0') break;
         
        int sum = 0;
        REP(i, x.size()) {
            sum += (x[i] - '0');
        }
        cout << sum << "\n";
    }
     
    return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define iton for(int i=0;i<n;i++)
#define jtom for(int j=0;j<m;j++)
#define itok for(int i=0;i<=k;i++)
void solve()
{
    long n,k;
    cin>>n>>k;
    // cout<<n<<k;
    vector<bool> dp(k+1,false);

    vector<long> v(n);

    iton
    cin>>v[i];

    for(int i=0;i<=k;i++)
    {
        for(int j=0;j<n;j++)
        {
            if(i-v[j] < 0)
            break;

            if(dp[i-v[j]]==false)
            {
                dp[i] = true;
                break;
            }
        }
    }
    
    // itok
    // cout<<dp[i]<<" ";
    if(dp[k])
    cout<<"First";
    else
    cout<<"Second";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    
        solve();
    
}


Measured memory_bytes: 256
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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 min(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func main() {
	sc.Split(bufio.ScanWords)

	N := getInt()
	h := make([]int, N)
	for i := 0; i < N; i++ {
		h[i] = getInt()
	}
	dp := make([]int, N)
	dp[0] = 0
	for i := 1; i < N; i++ {
		dp[i] = math.MaxUint32
	}
	for i := 1; i < N; i++ {
		if i == 1 {
			c0 := asub(h[i-1], h[i])
			dp[i] = min(dp[i], dp[i-1]+c0)
		} else {
			c0 := dp[i-1] + asub(h[i-1], h[i])
			c1 := dp[i-2] + asub(h[i-2], h[i])
			dp[i] = min(dp[i], min(c0, c1))
		}
	}
	out(dp[N-1])
}

Measured memory_bytes: 2688
import sys

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N, K = LI()
S = list(S())

S[K-1] = S[K-1].lower()
print(''.join(S))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()

int count(int x) {
  int y = 0;
  while(x > 0) {
    x /= 10;
    y++;
  }
  return y;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll cnt = 0;
  
  for (int i = 1; i <= n; i++ ) {
    if (count(i) %2 == 1)
      cnt++;
  }
  
  cout << cnt << "\n";

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
//#include<cmath>
//#include<algorithm>
//#include<cstring>
//#include<map>
using namespace std;
inline int read()
{
    int p=0,f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
    while(c>='0'&&c<='9'){p=p*10+c-'0';c=getchar();}
    return f*p;}
int main()
{
	int n=read(),a=read();
	n%=500;
	if(n>a)cout<<"No";
	else cout<<"Yes";
	return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> A(N);
    bool flag = true;
    for(int i=0;i<N;i++){
        cin>>A.at(i);
        if (A.at(i)%2==0){
            if(A.at(i)%3!=0&&A.at(i)%5!=0){
                flag = false;
            }
        }
    }
    if(flag==true){
        cout<<"APPROVED"<<endl;
    }else{
        cout<<"DENIED"<<endl;
    }
}


Measured memory_bytes: 256
use proconio::*;

fn main() {
    input! {
        c: [[i64; 3]; 3],
    };

    let mut ans = false;

    'outer: for a1 in 0..=100 {
        for a2 in 0..=100 {
            for a3 in 0..=100 {
                let b1_1 = c[0][0] - a1;
                let b2_1 = c[0][1] - a1;
                let b3_1 = c[0][2] - a1;
                let b1_2 = c[1][0] - a2;
                let b2_2 = c[1][1] - a2;
                let b3_2 = c[1][2] - a2;
                let b1_3 = c[2][0] - a3;
                let b2_3 = c[2][1] - a3;
                let b3_3 = c[2][2] - a3;

                if b1_1 == b1_2
                    && b1_3 == b1_1
                    && b2_1 == b2_2
                    && b2_3 == b2_1
                    && b3_1 == b3_2
                    && b3_3 == b3_1
                {
                    ans = true;
                    break 'outer;
                }
            }
        }
    }

    println!("{}", if ans { "Yes" } else { "No" });
}


Measured memory_bytes: 2160
(n,),*A=$<.map{|l|l.split.map &:to_i};d=0,0,*[-9e99]*n;2.times{E=d[-2];A.map{A.map{|a,b,c|d[b]=c if d[b]<c+=d[a]}}};puts E<d[-2]?:inf:E

Measured memory_bytes: 64764
#include<bits/stdc++.h>
using namespace std;
int mod = 1e9 + 7;
int n;
struct M
{
    vector<vector<int>> t;
    M() {
        t = vector<vector<int>>(n, vector<int>(n));
    }
    M(vector<vector<int>> &c)
    {
        t = c;
    }
    M operator* (const M& b) const {
        M c = M();
        for(int i = 0; i < n; i++)
            for(int j = 0; j < n ; j++)
                for(int k = 0; k < n; k++)
                    {
                        int p = ((long long)t[i][j] * b.t[j][k]) % mod;
                        c.t[i][k] = (c.t[i][k] + p) % mod;
                    }
        return c;
    }
};

int main()
{
    long long k;
    cin >> n >> k;
    vector<vector<int>> grid(n, vector<int>(n));
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            cin >> grid[i][j];
        }
    }

    M answer = M();
    for(int i = 0; i < n; i++)
        answer.t[i][i] = 1;
    
    M m{grid};
    while(k)
    {
        if(k % 2)
            answer = answer * m;
        m = m*m;
        k = k/2;
    }

    int total = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = 0; j < n; j++)
        {
            total = (total + answer.t[i][j]) % mod;
        }
    }
    cout << total;
    // // dp[i] - no. of ways in which we reach vertex i
    // vector<int> dp(n, 1);
    // // but K is huge to this will not work, use matrix exponentiation to improve
    // for(long long step = 0; step < k; step++)
    // {
    //     vector<int> dp2(n);
    //     for(int j = 0; j < n; j++)
    //     {
    //         for(int i=0; i < n; i++)
    //         {
    //             if(grid[j][i])
    //                 dp2[i] = (dp2[i] + dp[j]) % mod;
    //         }
    //     }
    //     dp = dp2;
    // }
    // int ans = 0;
    // for(int i =0 ; i < n; i++)
    //     ans = (ans + dp[i]) % mod;
    // cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
void Unused(...) {}
#ifndef DEBUG
  #define echo(...) Unused(__VA_ARGS__)
#else
  #define echo(...) fprintf(stderr, __VA_ARGS__)
#endif

const int MaxN = 100 + 7;

int h, w;
bool a[MaxN][MaxN];
bool used[2][MaxN];

int main()
{
    scanf("%d %d", &h, &w);
    for (int i = 1; i <= h; ++i)
    {
        getchar();
        for (int j = 1; j <= w; ++j)
        {
            if (getchar() == '.')
                a[i][j] = false;
            else
                a[i][j] = true;
        }
    }
    for (int i = 1; i <= h; ++i)
    {
        bool hide = true;
        for (int j = 1; j <= w; ++j)
            if (a[i][j])
            {
                hide = false;
                break;
            }
        used[0][i] = !hide;
    }
    for (int i = 1; i <= w; ++i)
    {
        bool hide = true;
        for (int j = 1; j <= h; ++j)
            if (a[j][i])
            {
                hide = false;
                break;
            }
        used[1][i] = !hide;
    }
    
    for (int i = 1; i <= h; ++i)
    {
        if (used[0][i])
        {
            for (int j = 1; j <= w; ++j)
                if (used[1][j])
                {
                    if (a[i][j])
                        printf("#");
                    else
                        printf(".");
                }
            printf("\n");
        }
    }

    return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
const int MAX = 1e5 + 10;
const double exps = 1e-8;

inline int max(int a, int b) { return a > b ? a : b; }
inline int min(int a, int b) { return a > b ? b : a; }

int main() {
    ll n, m;
    cin >> n >> m;
    cout << n * (n - 1) / 2 + (m - 1) * m / 2;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;

int main() {
    int h, w;
	cin >> h >> w;
	int d[10][10];
	rep(i,10) rep(j,10) cin >> d[i][j];
	rep(k,10) rep(i,10) rep(j, 10) chmin(d[i][j], d[i][k]+d[k][j]);
	
	int ans = 0;
	rep(i,h) rep(j,w) {
			int x;
			cin >> x;
			if (x!=-1) ans += d[x][1];
		}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n;
    cin >> n;
    vector<P> a(n);
    vector<P> b(n);
    rep(i, n)
    {
        cin >> a[i].first >> a[i].second;
        b[i].second = a[i].first;
        b[i].first = a[i].second;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    reverse(b.begin(), b.end());
    if (n % 2 == 1)
    {
        int mn = a[n / 2].first;
        int mx = b[n / 2].first;
        cout << mx - mn + 1 << endl;
    }
    else
    {
        int mn = (a[n / 2].first + a[n / 2 - 1].first);
        int mx = b[n / 2].first + b[n / 2 - 1].first;
        cout << mx - mn + 1 << endl;
    }
}

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

int main() {
    ll n, d;
    int res=0;
    cin >> n >> d;
    ll x[n], y[n];
    rep(i,n){
        cin >> x[i] >> y[i];
        if(sqrtl((x[i]*x[i])+(y[i]*y[i]))<=d){
            ++res;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 6740
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(size_t i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long

signed main(){
    string S;
    int hug=0;
    cin>>S;
    REP(i,(S.size()+1)/2){
        if(S[i]!=S[S.size()-i-1]){
            hug++;
        }
    }
    cout<<hug<<endl;
}

Measured memory_bytes: 384
import java.util.*;
public class Main {
    
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int K = scanner.nextInt();
        int[] nus = new int[N];
        for (int i = 0; i < K; i++) {
            int d = scanner.nextInt();
            for (int j = 0; j < d; j++) {
                int a = scanner.nextInt() - 1;
                nus[a] ++;
            }
        }
        int res = 0;
        for (int i = 0; i < N; i++) {
            if(nus[i] == 0){
                res++;
            }
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 46112
#include<stdio.h>
#define DATA 200

int main(){

	int a[DATA],b[DATA],c[DATA];
	int i,j,keta=0;

	j=0;
	while(scanf("%d %d",&a[j],&b[j]) != EOF)
		j++;

	for(i=0;i<j;i++){
		c[i]=a[i]+b[i];
		while(c[i]>0){
			c[i]/=10;
			keta++;
		}
		printf("%d\n",keta);
		keta=0;
	}

	return 0;
}

Measured memory_bytes: 600
n, k = map(int, input().split())
div = 10**9 + 7
ans = 0

for i in range(k, n+2):
  # 最小の和: 0 -> i-1 まで
  s_min = i * (i-1) // 2
  # 最大の和: n-i+1 -> n まで
  s_max = (n+1) * n // 2 - (n-i+1) * (n-i) // 2
  # とりうる個数
  s_count = s_max - s_min + 1
  # 答えに追加
  ans = (ans + s_count) % div

print(ans)

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

const int N = 2e3 + 5;
int a[N];

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin>>n;
  double sum=0;
  for(int i=0;i<n;i++){
    double x;
    cin>>x;
    sum+=(1/x);
  }
  cout<<(1/sum);
}


Measured memory_bytes: 256
// In the name of God

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;
const long long mod = 1e9+7;

long long cnt[N], cnt2[N];

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	long long ans = 1;
	int c = 0;
	for(int i=0;i<n;i++) {
		int x;
		cin >> x;
		if(x == 0) c++;
		cnt[x]++;
		cnt2[x]++;
		if(cnt2[x] >= 4) ans = 0;
		if(x) {
			if(!cnt[x-1]) ans = 0;
			ans = (ans*cnt[x-1])%mod;
			cnt[x-1]--;
		}
	}
	if(c >= 2) ans *= 6;
	if(c == 1) ans *= 3;
	cout << ans%mod;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    int a,b;
    cin>>a>>b;
    if((a+b)%2==0){
        cout<<(a+b)/2<<endl;
    }else{
        cout<<"IMPOSSIBLE"<<endl;
    }
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define fo(i,a,b) for(int i=a;i<=b;i++)
int N,x[120],y[120],h[120],H;
int main(){
	scanf("%d",&N);
	fo(i,1,N) scanf("%d%d%d",&x[i],&y[i],&h[i]);
	fo(cx,0,100)
		fo(cy,0,100){
			H=-1;
			fo(i,1,N) if (h[i]>0){
				H=h[i]+abs(cx-x[i])+abs(cy-y[i]);
				break;
			}
			if (H==-1) H=1;
			bool ok=1;			
			fo(i,1,N) if (std::max(H-abs(cx-x[i])-abs(cy-y[i]),0)!=h[i]){
				ok=0;
				break;
			}
			if (ok){
				printf("%d %d %d\n",cx,cy,H);
				return 0;
			}
		}
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
public class Main
{
    public static void main(String[] args) throws IOException{
    int area = 0;
    int times = 0;
    int i = 1;
    String s;
    int a = 0;
    int b = 0;
        while(i>0){
            BufferedReader x = new BufferedReader(new InputStreamReader(System.in));          
            s = x.readLine();
            StringTokenizer st = new StringTokenizer(s," ");
            a = Integer.parseInt(st.nextToken());
            b = Integer.parseInt(st.nextToken());

            if(a >= 1 && a <= 100 )
                i = -1;
            else if(b >= 1 && b <= 100)
                i = -1;
            else
                i = 1;
         }
        area = a*b;
        times = 2*a+2*b;
        System.out.println(""+area+" "+times+"");    
    }
}

Measured memory_bytes: 24268
#include <iostream>
#include <algorithm>
#include <cstdlib>

#define all(c) (c).begin(), (c).end()

typedef long long ll;
using namespace std;

ll func(ll n)
{
	string s;
	int c = 0;
	while (n) {
		int t = n % (-10) + c;
		s += char('0' + (t + 10) % 10);
		if (t == 10) n += 10;
		n /= (-10);
		c = (t < 0);
	}
	if (c) s += '1';
	reverse(all(s));
	return atoll(s.c_str());
}
int main()
{
	ios_base::sync_with_stdio(0);
	ll n;
	while (cin >> n) {
		if (n == 0) break;
		cout << func(n) << endl;
	}

	return 0;
}

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

int main() {
  int N, M, a=0;
  cin >> N >> M;
  vector<string> A(N), B(M);
  for (int i=0; i<N; i++) cin >> A.at(i);
  for (int i=0; i<M; i++) cin >> B.at(i);
  for (int i=0; i<N-(M-1); i++){
    for (int j=0; j<N-(M-1); j++){
      for (int k=0; k<M; k++){
        if(A.at(i+k).substr(j,M)!=B.at(k)) break;
        if(k==M-1) a=1;
      }
    }
  }
  if (a==1) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<int> H(N, 0);
	for(int i = 0; i < N; i += 1) cin >> H[i];
	int border = H[0];
	int cnt = 0;
	for(int& height : H)
	{
		if(height >= border)
		{
			cnt += 1;
			border = height;
		}
	}
	cout << cnt << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }
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; }

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

    ll N, K;
    cin >> N >> K;
    vector<P> A(N);
    rep(i,N){
        ll a,b;
        cin >> a >> b;
        A[i] = {a, b};
    }
    sort(ALL(A));

    rep(i, N){
        K -= A[i].second;
        if(K <= 0){
            print(A[i].first);
            return 0;
        }
    }

    return 0;
}

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

int main(void){
  long long A, B, K;
  cin >> A >> B >> K;
  
  if (A>=K){
    cout << A-K << " " << B <<endl;
  }else if (A+B>=K){
    cout << 0 << " " << B-K+A <<endl;
  }else{
    cout << 0 << " " << 0 <<endl;
  }
}

Measured memory_bytes: 256
from collections import Counter
 
n = int(input())
v = list(map(int,input().split()))
ac = Counter(v[::2]).most_common(2)
bc = Counter(v[1::2]).most_common(2)


if ac[0][0] != bc[0][0]:           
    ans =  n - ac[0][1] - bc[0][1] 
else:                               
    if len(bc) == 1 or len(ac) == 1:
        ans = n // 2
    else: 
        ans = n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])
print(ans)

Measured memory_bytes: 15588
H,W = map(int,input().split())

a = [list(input()) for i in range(H)]

not_removedH = []#捨てない行
for i in range(H):
    removed = True
    for j in range(W):
        if a[i][j]=="#":#一つでも黒があれば終わり
            removed = False
            break
    if not removed:
        not_removedH.append(i)

not_removedW = []#捨てない列
for j in range(W):
    removed = True
    for i in range(H):
        if a[i][j]=="#":
            removed = False
            break
    if not removed:
        not_removedW.append(j)


#捨てる列を削除していく
for i in range(H):
    tmp = []
    for j in not_removedW:
        tmp.append(a[i][j])
    a[i]=tmp

for i in not_removedH:
    print("".join(a[i]))


Measured memory_bytes: 67408
n = int(input())
a1 = input().split()
a2 = a1[:]
i = 0
flag = 1
while flag:
    flag = 0
    for j in range(n - 1, i, -1):
        if int(a1[j][1]) < int(a1[j - 1][1]):
            flag = 1
            a1[j], a1[j - 1] = a1[j - 1], a1[j]
    i += 1
print(" ".join(a1))
print("Stable")


for i in range(n):
    minj = i
    for j in range(i, n):
        if int(a2[j][1]) < int(a2[minj][1]):
            minj = j
    if minj != i:
        a2[i], a2[minj] = a2[minj], a2[i]
print(" ".join(a2))
if a1 == a2:
    print("Stable")
else:
    print("Not stable")


Measured memory_bytes: 5604
#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>;

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

  int result = 800 * n - (n / 15 * 200);

  cout << result << endl;

  return 0;
}


Measured memory_bytes: 256
// g++ -std=gnu++1y -O2 xxx.cpp

#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>;

int main() {
    int N,M; cin>>N>>M;
    vector<int> An(N);
    rep(i,N) cin>>An[i];
    int sum=accumulate(An.begin(),An.end(),0);

    int ans=0;
    rep(i,N) {
        if (4 * M * An[i] >= sum) {
            ans++;
        }
    }
    cout << (ans>=M?"Yes":"No") << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vs = vector<string>;
#define  rep(i,n) for(ll i = 0; i < (n); ++i)
#define  red(i,n) for(ll i = (n)-1; i >= 0; --i)
#define  all(a)   begin(a),end(a)
#define  pb(a)    push_back(a)
#define  yn(a)    cout << ( (a)?"Yes\n":"No\n" );
inline ll gcd(ll a,ll b) { return b?gcd(b,a%b):a; }
const ll INF = 1e9+9, LINF = 1e18;


int main()
{
    int n,m=INF;
    cin>>n;
    int a[n];
    rep(i,n)cin>>a[i];
    
    for(int i=-100;i<=100;i++){
        int x=0;
        rep(j,n) x+=(i-a[j])*(i-a[j]);
        m=min(x,m);
    }
    cout<<m<<endl;

    return 0;
}


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

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

  int before = S / 100;
  int after = S - (before * 100);

  if (before == 0 || before > 12) {
    if (after == 0 || after > 12) {
      cout << "NA" << endl;
    }
    else {
      cout << "YYMM" << endl;
    }
  }
  else {
    if (after == 0 || after > 12) {
      cout << "MMYY" << endl;
    }
    else {
      cout << "AMBIGUOUS" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(void) {
    int n;
    char str1[101], str2[101];
    int hanako = 0, tarou = 0;
     
    scanf("%d", &n);
     
    while (n--) {
        scanf("%s %s", str1, str2);
         
        if (strcmp(str1, str2) > 0) tarou += 3;
        else if (strcmp(str1, str2) < 0) hanako += 3;
        else {
            tarou++;
            hanako++;
        }
    }
     
    printf("%d %d\n", tarou, hanako);
     
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#define eps 1e-6
#define rep(i,n) for(int i=0;i<n;++i)
#define rep2(i,n) for(int i=1;i<=n;i++)
#define snc(a,b,c) ((a)?(b):(c))
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ins insert
#define pb push_back
using namespace std; 

int main(){
    int n,a[100001]={},d[100002]={},sum=0;
    cin >> n;
    rep2(i,n){
        cin >> a[i];
        d[i]=abs(a[i-1]-a[i]);
        sum += d[i];
    }
    d[n+1]=abs(a[n]);
    sum += d[n+1];
    rep2(i,n){
        int temp=sum;
        temp -= d[i]+d[i+1];
        temp += abs(a[i-1]-a[i+1]);
        cout << temp << endl;
    }
    return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
const ll INF = 1LL<<60;
 
ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
 
  int N;
  cin >> N;
 
  vector<vector<pair<int, int>>> xy(N);
 
  int A, x, y;
  for(int i = 0; i < N; i++){
    cin >> A;
    for(int j = 0; j < A; j++){
      cin >> x >> y;
      x--;
      xy[i].push_back(make_pair(x, y));
    }
  }
 
  int ans = 0;
  for(int bit = 0; bit < (1<<N); ++bit){
    bool is_ok = true;
    int tmp_ans = 0;
    for(int i = 0; i < N; ++i){
      if(bit & (1<<i)){//i番目の人が正直
        tmp_ans++;
        //全部あっているか確認
        for(int j = 0; j < xy[i].size(); j++){
          x = xy[i][j].first;
          y = xy[i][j].second;
          if(int((bit & (1<<x)) > 0) != int(y)){
            is_ok = false;
            // cout << int(bit & (1<<x)) << endl;
            // cout << x << " " << y << " " << bit << endl;
          }
        }
      }
    }
    if(is_ok){
      chmax(ans, tmp_ans);
    }
  }
 
  cout << ans << endl;
 
 
  return 0;
}

Measured memory_bytes: 256
[a, b, c, d] = [int(x) for x in input().split()]

who = 1
while(a > 0 and c > 0):
  if(who == 0):
    a -= d
  else:
    c -= b
  who = 1 - who

if(who == 0):
  print("Yes")
else:
  print("No")

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

/*
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
*/

#define INF 10e9
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;

typedef struct edge{
    long long int from;
    long long int to;
    long long int cost;
} edge;

int main(){
    long long int V, E, r;
    cin >> V >> E >> r;

    vector<edge> edges;
    long long int i;
    for(i = 0; i < E; i++){
        long long int s, t ,d;
        cin >> s >> t >> d;

        edge e;
        e.from = s;
        e.to = t;
        e.cost = d;
        edges.push_back(e);
    }

    long long int dist[V];
    for(i = 0; i < V; i++){
        dist[i] = INF;
    }

    dist[r] = 0;
    long long int count = 0;
    bool update;
    if(E == 0){
        update = false;
    }else{
        update = true;
    }
    
    while(update){
        count++;
        update = false;
        for(i = 0; i < E; i++){
            edge e = edges[i];
            if(dist[e.from] != INF && dist[e.to] > dist[e.from] + e.cost){
                dist[e.to] = dist[e.from] + e.cost;
                update = true;
            }
        }
        if(count == V){
            cout << "NEGATIVE CYCLE" << endl;
            return 0;
        }
    }

    for(i = 0; i < V; i++){
        if(dist[i] != INF){
            cout << dist[i] << endl;
        }else{
            cout << "INF" << endl;
        }
    }
}


Measured memory_bytes: 3200
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  ll sa;
  ll ans;
  for(ll i=1;i<=N;++i) {
    if(i*(i+1)/2>=N) {
      ans = i;
      sa = i*(i+1)/2-N;
      break;
    }
  }
  for(int i=1;i<=ans;++i) {
    if(i==sa) continue;
    cout<<i<<endl;
  }
}



Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>

using namespace std;

int main() {

    int a, b;
    cin >> a >> b;
    if (a == 1) {
        a = 14;
    }
    if (b == 1) {
        b = 14;
    }

    if (a > b)
        cout << "Alice";
    if (a < b)
        cout << "Bob";
    if (a == b)
        cout << "Draw";

}


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

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "YES" : "NO")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 2e5 + 10;
const int SIZ = 2e5 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "2";

int n;
int psum[siz], tmp[siz];

void compress() {
    vector <ii> data; /// value, index;
    for (int i = 1; i <= n; i++) {
        data.push_back(ii(psum[i], i));
    }

    sort (all(data));

    int num = 0, prv = MAXX;
    for (auto &x : data) {
        if (x.fi != prv) {
            prv = x.fi;
            num++;
        }
        psum[x.se] = num;
    }
}

int fen[SIZ];

void updatePos(int index, int value) {
    for (int i = index; i < SIZ; i += i & (-i)) {
        fen[i] += value;
    }
}

int getSum(int index) {
    int sum = 0;
    for (int i = index; i > 0; i -= i & (-i)) {
        sum += fen[i];
    }
    return sum;
}

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int k;
    cin >> n >> k;

    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;

        psum[i] = psum[i - 1] + a - k;
        tmp[i] = psum[i];
    }

    compress();

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += getSum(psum[i]);
        if (tmp[i] >= 0) {
            ans++;
        }
        updatePos(psum[i], 1);
    }

    cout << ans << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}


Measured memory_bytes: 10508