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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)
#define fi first
#define se second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;
template <class T> using vec = vector<T>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> P(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &P[i]);
  }

  ll ans = 0;
  ll cur = LL_INF;
  rep(i, 0, N) {
    if (cur < P[i]) {
      continue;
    }

    ans++;
    chmin(cur, P[i]);
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[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 T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) {
  T c = min(a, b), d = max(a, b);
  return c * (d / gcd(c, d));
}

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


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

int main() {
  int a,b;
  cin >> a >> b;
  int flug = 0;
  if ((1 <= a && a <= 10000)&&(1 <= b && b <= 10000)) {
    flug = 1;
  }
  if (flug == 1) {
    if (a % 2 == 1 && b % 2 == 1) {
      cout << "Odd" << endl;
    }
    else {
      cout << "Even" << endl;
    }
  }
}

Measured memory_bytes: 256
//压行课次
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int MAXN=3e5+10;
LL n,A,B,K,fac[MAXN],invl[MAXN],ans,mod=998244353;
LL read(){LL sss=0,fff=1;char ccc;ccc=getchar();while(ccc<'0'||ccc>'9'){if(ccc=='-')fff=-1;ccc=getchar();}while(ccc>='0'&&ccc<='9')sss=(sss<<1)+(sss<<3)+(ccc^'0'),ccc=getchar();return sss*fff;}
LL ksm(LL base,LL k)
{
	LL sum=1;
	while(k)
	{
		if(k&1) sum=sum*base%mod;
		base=base*base%mod;
		k>>=1;
	}
	return sum;
}
LL C(LL a,LL b)
{
	if(a<b) return 0ll;
	return fac[a]*invl[b]%mod*invl[a-b]%mod;
}
int main()
{
//	freopen("123.in","r",stdin);
//	freopen("123.out","w",stdout);
	n=read();A=read();B=read();K=read();
	fac[0]=1;for(LL i=1;i<=n;i++) fac[i]=fac[i-1]*i%mod;
	invl[n]=ksm(fac[n],mod-2);for(LL i=n-1;i>=0;i--) invl[i]=invl[i+1]*(i+1)%mod;
	for(LL i=0;;i++)
	{
		if(A*i>K) break;
		if((K-A*i)%B==0) 
		{
			LL b=(K-A*i)/B;
			ans=(ans+C(n,i)*C(n,b)%mod)%mod;
		}
	}
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N), inv(N);
    rep(i,0,N){
        cin >> V[i];
    }
    rep(i,0,N){
        inv[V[i]-1] = i + 1; 
    }
    rep(i,0,N){
        cout << inv[i] << " ";
    }
}

Measured memory_bytes: 1536
#include <iostream>
#include <cmath>
using namespace std;
int main(void){
    // Here your code !
 int r,p,f=90;
 char c;
 double x=0,y=0;
 
 while(cin>>r>>c>>p){
   if(r==0&&p==0) break;  
   
   x=x+r*cos(f*M_PI/180.0);
   y=y+r*sin(f*M_PI/180.0);
   f=f-p;
 }
 cout<<(int)x<<endl<<(int)y<<endl;
}

Measured memory_bytes: 1164
#include <iostream>
#include <sstream>  // istringstream
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main()
{   
    // 練習でやった問題, 逆から探索する
    int a, b;
    char op;
    cin >> a >> op >> b;

    if(op == '+'){
        cout << a+b << endl;
    }
    else{
        cout << a-b << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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)
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;

ll p(ll a, ll b) {
  return a * a * a * a + a * a * a * b + a * a * b * b + a * b * b * b +
         b * b * b * b;
}

int main() {
  int X;
  cin >> X;
  int sqrtX = floor(sqrt(X));
  VI fa;
  rrep(i, sqrtX) {
    if (X % i == 0) {
      fa.push_back(i);
    }
  }
  for (auto f : fa) {
    int revf = X / f;
    int quad = floor(sqrt(sqrt(X / f)));
    for (int q = quad / 3 - f; q < quad + 1; q++) {
      if (revf == p(q, q + f)) {
        cout << q + f << " " << q << endl;
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 3692
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int ans = 0;
		for(int i = 0; i < N; i++)
			if(sc.nextInt() >= K)
				ans++;
		System.out.println(ans);

	}

}

Measured memory_bytes: 46576
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(int)n; i++)
int main() {
  const int MAX=100;
  int h,w;
  char a[MAX][MAX];
  cin>>h>>w;
  rep(i,h){
    rep(j,w){
      cin>>a[i][j];
    }
  }
  rep(i,w+2) cout<<"#";
  cout<<endl;
  rep(i,h){
    cout<<"#";
    rep(j,w) cout<<a[i][j];
    cout<<"#";
    cout<<endl;
  }
  rep(i,w+2) cout<<"#";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#include<math.h>
#include<numeric>
#include<iomanip>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define PI acos(-1);
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
//scanf("%d", &a); '\n'; cout << fixed << setprecision(10);

ll RepeatSquaring(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RepeatSquaring(N, P / 2, M);
		return t * t % M;
	}
	return N * RepeatSquaring(N, P - 1, M);
}
long long binExp(long long a, long long e) {
	if (e == 0) {
		return 1;
	}

	if (e % 2 == 1) {
		return (binExp(a, e - 1) * a) % MOD;
	}

	long long b = binExp(a, e / 2);
	return (b * b) % MOD;
}

long long f(long long a) {
	long long r = 1;
	for (long long i = 2; i <= a; ++i) {
		r = (r * i) % MOD;
	}

	return r;
}

long long inv(long long a) {
	return binExp(a, MOD - 2);
}

ll tomi(ll n, ll k) {
	ll w = 1;
	ll N = n;
	while (N >= n - k + 1) {
		w *= N;
		w %= MOD;
		N--;
	}
	return w;
}
long long c(long long n, long long k) {
	long long a = tomi(n,k);
	long long b = inv(f(k));

	return (a * b) % MOD;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a,b;
	cin >> n >> a>>b;
	ll A = RepeatSquaring(2, n, MOD);
	ll B, C;
	B = c(n, a); C = c(n, b);
	ll D = A - B - C - 1;
	D %= MOD;
	if(D<0)cout << D+MOD;
	else cout << D;
}

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

int n;
string Get(int x)
{
	cout<<x<<'\n';;
	fflush(stdout);
	string s;
	cin>>s;
	return s;
}

int main()
{
	
	cin>>n;
	string C0=Get(0);
	if(C0=="Vacant") return 0;
	string Cn_1=Get(n-1);
	if(Cn_1=="Vacant") return 0;
	int l=1,r=n-2;
	while(r>=l)
	{
		int mid=(l+r)/2;
		string Cmid=Get(mid);
		if(Cmid=="Vacant") return 0;
		if(mid%2==0)
			if(Cmid==C0) l=mid+1;
			else r=mid-1;
		else
			if(Cmid==Cn_1) l=mid+1;
			else r=mid-1;
	}
	
	return 0;
}

Measured memory_bytes: 852
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>

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

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

    int n;
    cin>>n;
    int cnt=0;
    
    for(int i=1; i<=n; i++){
        int p;
        cin>>p;
        if(p!=i) cnt+=1;
    }
    if(cnt<=2) cout<<"YES";
    else cout<<"NO";

    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
a=set([int(input()) for i in range(m)])#setにしないとTLEになる
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)
    if i in a:
        dp[i]=0
print(dp[n])
# 入力
# 6 1
# 3

Measured memory_bytes: 13124
def solve(n, m, a, b):
    V = [i+1 for i in range(n)]
    E = {v: [] for v in V}
    for i in range(m):
        E[a[i]].append(b[i])
        E[b[i]].append(a[i])
    parent = {}
    que = [1]
    while que:
        s = que.pop(0)
        for t in E[s]:
            if not t in parent:
                parent[t] = s
                que.append(t)
    if len(parent) < n - 1:
        ans = ["No"]
    else:
        ans = ["Yes"] + [str(parent[v]) for v in range(2,n+1)]
    return "\n".join(ans)

n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())
print(solve(n, m, a, b))

Measured memory_bytes: 60572
#include <stdio.h>

int main(void)


{


  int a,b,c;


  scanf("%d %d %d", &a,&b,&c);


  if(a<b && b<c)


  {


    printf("Yes\n");


  }


  else


  {


    printf("No\n");


  }


  return 0;


}

Measured memory_bytes: 580
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    vector<Pi> a(N);
    rep(i,N){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.rbegin(),a.rend());
    set<int> st;
    rep(i,N) st.insert(i);
    st.insert(-1);
    st.insert(N);
    ll ans = 0;
    rep(i,N){
        auto p = st.upper_bound(a[i].second);
        ll n1 = *p-a[i].second;
        p--;
        p--;
        ll n2 = a[i].second-*p;
        ans += n1*n2*a[i].first;
        st.erase(a[i].second);
    }
    cout << ans << endl;
}
    



Measured memory_bytes: 11136
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
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;
}

void solve() {
	int a; cin >> a;
	int b; cin >> b;
	string ans = (a * b) % 2 == 1 ? "Odd" : "Even";
	cout << ans << endl;
    return;
}

int main() {
    solve();
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<cassert>
 
using namespace std;
 
#define sz(x) (int)(x.size())
#define fr(i, a, b) for(int i=a;i<b;++i)
#define fdr(i, a, b) for(int i=b-1;i>=a;--i)
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
/////////////////

void solve(){
	ll ans = 1e9 * 1LL * 1e9 + 41;
	int n;
	vector<int> a;
	ll s = 0;
	cin >> n;
	fr(i, 0, n){
		int v;
		cin >> v;
		s += v;
		a.pb(v);
	}
	ll s2 = 0;
	fr(i, 0, n-1){
		s -= a[i];
		s2 += a[i];
		ans = min(ans, abs(s - s2));
	}
	cout << ans << endl;
}
 
int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif
 
	solve();
 
 
	return 0;
}

Measured memory_bytes: 1400
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    long long a, b, c=100000000, d=-1000000000, e=0;
    cin >> a;
    for(int i=0;i < a;i++){
        cin >> b ;
        if(b<=c){
           c = b; 
        }
        if(b>=d){
            d = b;
        }
        e = e + b;
    }
    cout << c << " " << d << " " << e << endl;
}


Measured memory_bytes: 3088
package main

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

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		sum := io.NextInt();
		if sum == 0 {
			break
		}
		for i := 0; i < 9; i++ {
			sum -= io.NextInt()
		}
		io.Println(sum)
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}



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

using namespace std;

int main(){
    int N;
    long long int ans=0;
    unordered_map<string,int> mp;
    string str;
    vector<string> vec;
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> str;
        sort(str.begin(),str.end());
        if(mp[str]!=0){
            ans += mp[str];
            mp[str]++;
        }else{
            mp[str] = 1;
        }
    }

    cout << ans;
}

Measured memory_bytes: 10660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
#define ALL(a)  (a).begin(),(a).end()
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
static const double pi = 3.141592653589793;



int main(){
    ll A, B, C, D;
    cin>>A>>B>>C>>D;
    cout<<min(A, B)+min(C, D)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
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;}
#define y0 y3487465 //j0
#define y1 y1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;



void Main(){

  int M;
  cin>>M;

  cout<< 48-M<<"\n";
}

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


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<map>
#include<cmath>
#include<algorithm>
using namespace std;
typedef pair < int , int > Pt;
bool dp[1 << 24];
Pt pts[24];
int n, r[24], c[24];
const int INF = 1 << 28;
bool intersect( Pt a, Pt b, int r1, int r2){
  return pow( a.first - b.first, 2) + pow( a.second - b.second, 2) < pow( r1 + r2, 2);
}

int isnocover( const int& bit, const int& idx ){
  for(int i = 0 ; i < idx ; i++ ){
    if( (bit >> i) & 1 && intersect( pts[i], pts[idx], r[i], r[idx])) return false;
  }
  return true;
}

int rec( int bit){
  if(dp[bit]++) return -INF;
  int ret = 0;
  for(int i = 0 ; i < n ; i++ ){
    if((bit >> i) & 1){
      for(int j = i + 1 ; j < n ; j++ ){
        if( (bit >> j) & 1 && c[i] == c[j] && isnocover( bit, i) && isnocover( bit, j)){
          ret = max( ret, rec( bit & ~(1 << i) & ~(1 << j)) + 2);
        }
      }
    }
  }
  return ret;
}
int main()
{
  while(cin >> n, n){
    fill_n( dp, 1 << 24 , false);
    for(int i = 0 ; i < n ; i++ ){
      cin >> pts[i].first >> pts[i].second >> r[i] >> c[i];
    }
    cout << rec((1 << n) - 1) << endl;
  }
}

Measured memory_bytes: 17544
/*
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
typedef mp::cpp_int mint; //*/
#include <bits/stdc++.h>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  red(i,n) for(li i=n;i>0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;


int main()
{
    string a,b,c;
    cin>>a>>b>>c;
    cout<<((a[a.size()-1]==b[0]&&b[b.size()-1]==c[0])?"YES":"NO")<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <math.h>
using namespace std;

int solve(int x){
    int ans=0;
    while(x%2==0){
        ans++;
        x/=2;
    }
    return ans;
}
int main(void){
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        a[i]=solve(a[i]);
    }
    sort(a.begin(),a.end());
    cout<<a[0]<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    res = [2, 1]

    for i in range(100):
        cur = res[i] + res[i + 1]
        res.append(cur)

    print(res[N])


if __name__ == '__main__':
    main()


Measured memory_bytes: 61952
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <ios> 
#include <bits/stdc++.h>
using namespace std;
int n;
string s;
int t[26];
typedef long long ll;
ll ans=1;
int main(){
	cin>>n>>s;
	for (int i=0;i<s.size();i++)
		t[s[i]-'a']++;
	for (int i=0;i<26;i++)
		ans=ans*(t[i]+1)%(1000000007);
	ans--;
	cout<<ans;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    string s,t;
    cin >> s >> t;
    int k = t.size();
    int ans = INF;
    for(int i=0;i<=(int)(s.size())-k;i++){
        int res = 0;
        rep(j,k){
            if(s[i+j]!=t[j]) ++res;
        }
        ans = min(ans,res);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define int long long

using namespace std;

const int O = 1e6 + 5;

int n, k, a;

map <int, int> Map;

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin >> n >> k;
    for (int i = 1; i <= n; ++ i){
        int x; cin >> x;
        for (int j = 1; j <= x; ++ j){
            int y; cin >> y;
            Map[y] ++;
        }
    }
    int Ans = 0;
    for (int i = 1; i <= n; ++ i) 
        if (!Map[i]) ++ Ans;
    cout << Ans;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
int main(){ 
    int a,b,c;
    cin>>a>>b>>c;
    int d;
    d=max(a,max(b,c));
    cout<<a+b+c-d;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <bits/stdc++.h>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define rep(i,strt,end) for(long long i = strt;i < end;i++)


int main(){
    unsigned long long x[6];
    rep(i,1,6){
        cin >> x[i];
        if(x[i] == 0){
            x[0] = i;
        }
    }
    cout << x[0] << endl;
    //--------------
    return 0;
}

Measured memory_bytes: 3556
package main

import "fmt"

func get2() (a, b int) {
	fmt.Scanf("%d %d", &a, &b)
	return
}

func main() {
	fmt.Println(solve())
}

func solve() int {
	limit, k := get2()
	if k%2 == 1 {
		return (limit / k) * (limit / k) * (limit / k)
	}
	half_base := (k / 2)
	useable := 0
	result := half_base
	for {
		if result > limit {
			break
		}
		result += k
		useable++
	}
	return useable*useable*useable + (limit/k)*(limit/k)*(limit/k)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
        #define ll long long
        #define rep(i,a,b) for(i=a;i<b;i++)
        #define pb push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define vi vector < ll  int >
        #define CLR(a) memset((a),0,sizeof(a))
        #define mp make_pair
        #define hell 1000000007
        using namespace std;

        void solve()
           {
               ll i,j=0,r=200,p,q,k=0,ans=0,d,y=0,x,h,flag=0,n,m=0,a=hell,b=hell,id,c,h1,h2,a1,b1,w;
               cin>>n;
               vi v(n);
               rep(i,0,n) cin>>v[i];
               rep(i,0,n-1)
                 {
                     if(v[i]-v[i+1]>1) {cout<<"No"; return;}
                 }
                 rep(i,0,n-1)
                   {
                       if(v[i]>v[i+1])
                       {
                           v[i]-=1;

                       }
                       else if(v[i]==v[i+1] and i>0 and v[i]>v[i-1]) v[i]-=1;

                   }
                 rep(i,0,n-1)
                  {
                      if(v[i]<=v[i+1]) continue;
                      else {cout<<"No"; return;}
                  }
                  cout<<"Yes";




           }
        signed main()
        {
            ios::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int t=1;
            //cin>>t;
            while(t--)
            solve();
        }


Measured memory_bytes: 1024
n, w = map(int, input().split())
wt = []
v = []
for _ in range(n):
    a, b = map(int, input().split())
    wt.append(a)
    v.append(b)

total_value = 0
for i in v:
    total_value += i

dp = [float("inf")] * (total_value + 1)
dp[0] = 0
for i in range(len(wt)):
    for j in range(total_value, v[i] - 1, -1):
        dp[j] = min(dp[j], dp[j - v[i]] + wt[i])
ans = 0
for i in range(len(dp)):
    if dp[i] <= w:
        ans = max(ans, i)
print(ans)


Measured memory_bytes: 90836
#![doc = " # Bundled libraries"]
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
fn main() {
    input! { n : u64 , mut x : usize , m : usize , }
    let mut t = vec![None; m];
    let mut v = vec![];
    while t[x] == None {
        t[x] = Some(v.len());
        v.push(x as u64);
        x *= x;
        x %= m;
    }
    if n <= v.len() as u64 {
        println!("{}", v[..n as usize].iter().sum::<u64>());
    } else {
        let y = t[x].unwrap();
        let mut res = v[..y].iter().sum::<u64>();
        let n = n - y as u64;
        let v = v[y..].iter().collect_vec();
        for i in 0..v.len() {
            res += v[i] * (n / v.len() as u64);
            if (i as u64) < (n % v.len() as u64) {
                res += v[i];
            }
        }
        println!("{}", res);
    }
}


Measured memory_bytes: 4240
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////

int main(){

  int n;
  I(n);
  int ar[n+2];
  for(int i = 1;i<=n;i++)I(ar[i]);
  int ans = 100000000;
  for(int i = 1;i<=100;i++){
      int res = 0;
      for(int j = 1; j<=n;j++){
          res += (i - ar[j]) *(i- ar[j]);
      }
      ans = min(ans, res);
  }

  cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int A, B, C;
    cin >> A >> B >> C;
    int ret = 0;
    while(B > 0 && C > 0){
        ret += 2;
        B--;
        C--;
    }
    while(B > 0){
        ret++;
        B--;
    }
    while(A > 0 && C > 0){
        ret++;
        A--;
        C--;
    }
    if(C > 0){
        ret++;
    }
    cout << ret << endl;
}


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

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); } 
                catch (IOException e) { throw new RuntimeException(e);} }
            return tokenizer.nextToken(); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        
        int n = r.nextInt();
        int k = r.nextInt();
        int ans = 0;
        for(int i = 0; i < n; i++){
            if(r.nextInt() >= k) ans++;
        }
        pw.println(ans);
        pw.close();
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

Measured memory_bytes: 31468
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
INF = float("inf")

########

if __name__ == "__main__":
    N, M = l_inpl()

    to = [[] for _ in range(N)]

    for _ in range(M):
        u, v = l_inpl()
        u, v = u-1, v-1
        to[u].append(v)

    S, T = l_inpl()
    S, T = S-1, T-1

    dist = [[INF, INF, INF] for _ in range(N)]
    dist[S][0] = 0

    q = deque([])
    q.append([S, 0])

    while q:
        v, l = q.popleft()
        for v_to in to[v]:
            nl = (l + 1) % 3
            if dist[v_to][nl] != INF:
                continue
            dist[v_to][nl] = dist[v][l] + 1
            q.append([v_to, nl])
    
    ans = dist[T][0]
    if ans == INF:
        ans = -1
    else:
        ans = ans//3
    
    print(ans)



Measured memory_bytes: 86048
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include<bits/stdc++.h>
using ll = long long;
using namespace std;
using pii =pair<int,int>;

int n;

void input(){
    cin>>n;
}

void src(){
    cout<<setprecision(10)<<fixed<<double((n+1)/2)/n;
    return;
}

int main(int argc,char* argv[]){
    //ifstream in( argv[1] ); cin.rdbuf(in.rdbuf());
    input();
    src();    
    return 0;
}

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


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
 
    int n;
    cin>>n;
    int ans = 1;
    while(n>=2){
        ans*=2;
        n/=2;
    }
    cout << ans<< endl;
    
}


Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
#define MOD 1000000007
#define INF 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define req(i, j, n) for(int i = j; i <= (int)(n); i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
  int n;
  cin>>n;
  int t[n+1];  
string st[n+1];
  for(int i=1;i<=n;i++){
    string s;
    int tt;
    cin>>s;
    cin>>tt;
    st[i]=s;
    t[i]=tt;
  }
  string ans;
  cin>>ans;
  
  int val=0;
  for(int i=1;i<=n;i++){
    if(st[i]==ans){
      for(int j=i+1;j<=n;j++){
        val+=t[j];}
      break;}
  }
  
  cout<<val<<endl;
      

}

Measured memory_bytes: 256
#include<iostream>

int calc(int x, int y, std::string op);

int main()
{
	int a, b, ans;
	std::string Operator;

	while(true)
	{
		std::cin >> a >> Operator >> b;
		
		if(Operator =="?")
		{ 
			break;
		}

		ans = calc(a, b, Operator);

		std::cout << ans << std::endl;
	}

	return 0;
}

int calc(int x, int y, std::string op)
{
	int ans;

	if (op == "+")
	{
		ans = x + y;
	}
	else if (op == "-")
	{
		ans = x - y;
	}
	else if (op == "*")
	{
		ans = x * y;
	}
	else if (op == "/")
	{
		ans = x / y;
	}

	return ans;
}


Measured memory_bytes: 3100
#include <stdio.h>

int main(void)
{
    char inputString[1100] = {};
    char answer[1100] = {};
    int i;
    int answerNumber = 0;
    
    scanf("%s", &inputString);
    for(i = 0; inputString[i] != '\0'; i++){
        if(i % 2 == 0){
            switch (inputString[i]){
            	case '1':
                    if(inputString[i + 1] == 'T'){
                        answer[answerNumber] = 'a';
                    }else if(inputString[i + 1] == 'L'){
                        answer[answerNumber] = 'i';
                    }else if(inputString[i + 1] == 'U'){
                        answer[answerNumber] = 'u';
                    }else if(inputString[i + 1] == 'R'){
                        answer[answerNumber] = 'e';
                    }else if(inputString[i + 1] == 'D'){
                        answer[answerNumber] = 'o';
                    }
                    i++;
                    break;
                case '2':
                    answer[answerNumber] = 'k';
                    break;
                case '3':
                    answer[answerNumber] = 's';
                    break;
                case '4':
                    answer[answerNumber] = 't';
                    break;
                case '5':
                    answer[answerNumber] = 'n';
                    break;
                case '6':
                    answer[answerNumber] = 'h';
                    break;
                case '7':
                    answer[answerNumber] = 'm';
                    break;
                case '8':
                    answer[answerNumber] = 'y';
                    break;
                case '9':
                    answer[answerNumber] = 'r';
                    break;
                case '0':
                    if(inputString[i + 1] == 'U'){
                        answer[answerNumber] = 'n';
                        answer[answerNumber + 1] = 'n';
                        answerNumber++;
                        i++;
                    }else{
                        answer[answerNumber] = 'w';
                    }
                    break;
                default:
                    break;
            }
            answerNumber++;
        }else{
            switch (inputString[i]){
                case 'T':
                    answer[answerNumber] = 'a';
                    break;
                case 'L':
                    answer[answerNumber] = 'i';
                    break;
                case 'U':
                    answer[answerNumber] = 'u';
                    break;
                case 'R':
                    answer[answerNumber] = 'e';
                    break;
                case 'D':
                    answer[answerNumber] = 'o';
                    break;
                default:
                    break;
            }
            answerNumber++;
        }
    } 
    
    printf("%s\n", answer); 
    
     
     
    return 0;
}

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

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;

set<int> existBomb;
const int WMAX = 300000;
int NY[300300], NX[300300];

signed main() {
    int H, W, M;
    cin >> H >> W >> M;
    int maxrow = -1, maxcol = -1;
    rep(i, M) {
        int h, w;
        cin >> h >> w;
        --h, --w;
        int idx = h * WMAX + w;
        existBomb.insert(idx);
        ++NY[h], ++NX[w];
        if (maxrow == -1 || NY[h] > NY[maxrow])maxrow = h;
        if (maxcol == -1 || NX[w] > NX[maxcol])maxcol = w;
    }
    vector<pii> NNY, NNX;
    rep(i, 300000) {
        if (NY[i] == NY[maxrow]) {
            NNY.emplace_back(NY[i], i);
        }
        if (NX[i] == NX[maxcol]) {
            NNX.emplace_back(NX[i], i);
        }
    }
    uniform_int_distribution<> dy(0, NNY.size() - 1);
    uniform_int_distribution<> dx(0, NNX.size() - 1);
    random_device rnd;
    mt19937 mt(rnd());
    bool ans = false;
    rep(i, 3000000) {
        int y = dy(mt);
        int x = dx(mt);
        int h = NNY[y].second;
        int w = NNX[x].second;
        ans |= !existBomb.count(h * WMAX + w);
    }
    cout << NY[maxrow] + NX[maxcol] - (ans ? 0 : 1) << endl;
    return 0;
}


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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<ll> A(N),B(N);
  for(int i(0);i<N;i++) cin>>A[i];
  for(int i(0);i<N;i++) cin>>B[i];
  ll suma(0),sumb(0);
  for(int i(0);i<N;i++){
    suma += A[i];
    sumb += B[i];
  }
  if(suma < sumb){
    cout << "-1" << endl;
    return 0;
  }
  ll tarinai_sum(0),cnt_tarinai(0);
  for(int i(0);i<N;i++){
    if(A[i] < B[i]){
      tarinai_sum += (B[i] - A[i]);
      cnt_tarinai++;
    } 
  }
  //cout << cnt_tarinai <<" " << tarinai_sum<< endl;
  vector<ll> yobun;
  for(int i(0);i<N;i++){
    if(A[i] > B[i]){
      yobun.push_back(A[i]-B[i]);
    }
  }
  sort(yobun.rbegin(),yobun.rend());
  ll cnt(0);
  ll tmp(0);
  for(int i(0);i<int(yobun.size());i++){
    if(tmp >= tarinai_sum){
      cout << cnt_tarinai + cnt << endl;
      return 0;
    }
    tmp += yobun[i];
    cnt++;
  //  cout << tarinai_sum << " " << cnt << endl;
  }
  if(tmp >= tarinai_sum){
    cout << cnt_tarinai + cnt << endl;
    return 0;
  }
  return 0;
}


Measured memory_bytes: 2428
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int main(){
    int temp;
    priority_queue<int, vector<int>, greater<int>> que;
    for(int i = 0; i < 3; i++){
        cin >> temp;
        que.push(temp);
    }
    
    int x, y;
    x = que.top();
    que.pop();
    y = que.top();
    que.pop();
    y += 10 * que.top();
    que.pop();
    
    cout << x + y << endl;
}

Measured memory_bytes: 256
def solve(string):
    n, k = map(int, string.split())
    c = (n - 1) * (n - 2) // 2 - k
    if c < 0:
        return "-1"
    ans = []
    for i in range(1, n):
        ans.append("{} {}".format(i, n))
    for i in range(1, n):
        for j in range(i + 1, n):
            if c == 0:
                break
            c -= 1
            ans.append("{} {}".format(i, j))
    return "{}\n".format(len(ans)) + "\n".join(ans)


if __name__ == '__main__':
    print(solve(input()))


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

using namespace std;

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

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
    for (auto a: v)
        out << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const set<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename T>
ostream& operator<<(ostream& out, const multiset<T>& S) {
    for (auto a: S)
        cout << a << " ";
    return out;
}

template<typename S, typename T>
ostream& operator<<(ostream& out, const map<S, T>& M) {
    for (auto m: M)
        cout << "(" << m.first << "->" << m.second << ") ";
    return out;
}

template<typename S, typename T>
pair<S, T> operator+(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first + b.first, a.second + b.second);
}

template<typename S, typename T>
pair<S, T> operator-(pair<S, T> a, pair<S, T> b) {
    return make_pair(a.first - b.first, a.second - b.second);
}

vector<long long> solve(vector<long long>& A) {
    int n = A.size();
    long long total = 0;
    map<long long, long long> M;
    for (auto a: A)
        M[a]++;
    for (auto p: M) {
        total += p.second * (p.second - 1) / 2;
    }
    vector<long long> ans(n);
    for (int i = 0; i < n; i++) {
        ans[i] = total - (M[A[i]] - 1);
    }
    return ans;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;
    vector<long long> A;
    cin >> n;
    A.resize(n);
    for (int i = 0; i < n; i++)
        cin >> A[i];
    auto ans = solve(A);
    for (auto a: ans)
        cout << a << '\n';
    return 0;
}


Measured memory_bytes: 12672
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define FOR(i,init,a) for(int i=init; i<a; i++)
#define rep(i,a) FOR(i,0,a)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

int N;

bool solve(vector<string>& s){
    rep(i,N)for(int j=i;j<N;j++){
        if(s[i][j]!=s[j][i]) return false;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>N;
    vector<string> s(N);
    
    rep(i,N) cin>>s[i];
    
    ll sum=0;
    rep(k,N){
        rotate(s.begin(),s.begin()+1,s.end());
        if(solve(s)) sum++;
    }
    
    cout1(sum*N);
}

Measured memory_bytes: 384
#include <cstdio>
typedef long long ll;
inline int rd(){
    int x=0,p=1;
    char a=getchar();
    while((a<48||a>57)&&a!='-')a=getchar();
    if(a=='-')p=-p,a=getchar();
    while(a>47&&a<58)x=(x<<1)+(x<<3)+(a&15),a=getchar();
    return x*p;
}
const int N=3002;
struct Edge{
	int to,next;
}edge[N<<1];
int head[N],cnt;
int n,a[N],f[N];
inline void add(int f,int t){
	edge[++cnt].next=head[f];
	edge[cnt].to=t;
	head[f]=cnt;
}
inline void dp(int u,int ft){
	f[u]=0;
	for(int i=head[u];i;i=edge[i].next){
		int v=edge[i].to;
		if(v==ft)continue;
		dp(v,u);
		if(f[v]==0&&a[u]>a[v])f[u]=1;
	}
}
int main(){
	n=rd();
	for(int i=1;i<=n;i++)a[i]=rd();
	for(int i=1;i<n;i++){
		int u=rd(),v=rd();
		add(u,v),add(v,u);
	}
	for(int i=1;i<=n;i++){
		dp(i,0);
		if(f[i])printf("%d ",i);
	}
	puts("");
    return 0;
}

Measured memory_bytes: 256
S = input()
EVEN = 0
ODD = 0
for i in range(len(S)):
  if i%2 == 0:
    if S[i] == '1':
      EVEN += 1
  else:
    if S[i] == '0':
      EVEN += 1
for i in range(len(S)):
  if i%2 == 0:
    if S[i] == '0':
      ODD += 1
  else:
    if S[i] == '1':
      ODD += 1
print(min(len(S)-EVEN,len(S)-ODD))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
using namespace std;
int main() {
	int s[40] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };
	int k;
	cin >> k;
	cout << s[k - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
main()
{
	int x;
	cin>>x;
	int sum=0,a1;
	if(x/500!=0)
	{
		a1=x/500;
		sum+=(2*a1*500);
		x=x-a1*500;
	}
	if(x/5!=0)
	{
		a1=x/5;
		sum+=(a1*5);
	}
	cout<<sum<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define sz size()
#define pb push_back
#define mp make_pair
#define ALL(X) (X).begin(),(X).end()

using namespace std;

const int INF = 1000000000;
const double eps = 1e-8;
/*
int root(vector<int> & ufa,int i)
{
	if(i != ufa[i])
		ufa[i] = root(ufa,ufa[i]);
	return ufa[i];
}

void join(vector<int> & ufa,int i,int j)
{
	int ri = root(ufa,i);
	int rj = root(ufa,j);
	ufa[ri] = rj;
}
*/
struct edge
{
	int s;
	int t;
};

int main(void) {
	while(1)
	{
  	int n;
  	cin>>n;
  	if(!n)break;
  	vector<vector<int> > ary(n);
  	vector<int> l(n);
  	int gsize = 30+n;
  	vector<vector<int> > dist(gsize,vector<int>(gsize,INF));
  	REP(i,n)
  	{
  		cin >> l[i];
  		ary[i] = vector<int>(l[i]);
  		REP(j,l[i])cin>>ary[i][j];
  		sort(ALL(ary[i]));
  		if(l[i])
  			dist[i][n+ary[i][0]-1] = 1;
  		FOR(j,1,l[i])
  		{
  			dist[n+ary[i][j-1]-1][n+ary[i][j]-1] = 1;
  		}
  	}
  	REP(i,gsize)REP(j,gsize)REP(k,gsize)
  		dist[j][k] = min(dist[j][k],dist[j][i]+dist[i][k]);
  	int days = -1;
  	REP(i,30)
  	{
  		bool flg = true;
  		REP(j,n)
  		{
  			if(dist[j][n+i] >= INF)
  			{
  				flg = false;
  				break;
  			}
  		}
  		if(flg)
  		{
  			days = i+1;
  			break;
  		}
  	}
  	cout << days << endl;
  }
  return 0;
}

Measured memory_bytes: 1252