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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int n;
	cin>>n;
	vector<pair<int, int> > a(n);
	for(auto &x : a){
		cin>>x.second>>x.first;
	}
	sort(a.begin(), a.end());
	ll cur = 0;
	for(auto x : a){
		cur += x.second;
		if(cur > x.first){
			cout<<"No"<<endl;
			exit(0);
		}
	}
	cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  string s;
  cin>>s;
  reverse(s.begin(),s.end());
  while(s.size()!=0){
    if(s[0]=='m'){
      string tmp=s.substr(0,5);
      if(tmp!="maerd"){
        cout<<"NO";
        return 0;
      }
      s.erase(0,5);
    }
    else if(s[0]=='e'){
      string tmp=s.substr(0,5);
      if(tmp!="esare"){
        cout<<"NO";
        return 0;
      }
      s.erase(0,5);
    }
    else if(s[0]=='r'){
      if(s[2]=='s'){
        string tmp=s.substr(0,6);
        if(tmp!="resare"){
          cout<<"NO";
          return 0;
        }
        s.erase(0,6);
      }
      else if(s[2]=='m'){
        string tmp=s.substr(0,7);
        if(tmp!="remaerd") {
          cout<<"NO";
          return 0;
        }
        s.erase(0,7);
      }
      else {
        cout<<"NO";
        return 0;
      }
    }
    else{
      cout<<"NO";
      return 0;
    }
  }
  cout<<"YES";
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.rbegin(), a.rend())
using namespace std;

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

    ll n, sum = 0; cin>>n;
    loop(n){
        if((i+1)%3==0 || (i+1)%5==0) continue;
        sum += i+1;
    }
    cout<<sum<<"\n";
    return 0;
}

Measured memory_bytes: 3652
import numpy as np
N = int(input())
A = np.array(input().split()).astype(type(N))
B = np.array(input().split()).astype(type(N))

Knock_Down = 0

for i in range(N):
    #print("{}番目の勇者について".format(i))
    if(A[i] >= B[i] ):
        #print("{}体倒しました この勇者は終了です".format(B[i]))
        Knock_Down +=   B[i]
        A[i] -=B[i] 
        B[i] = 0

    elif(A[i] < B[i]):
        Knock_Down += A[i]
        B[i] -= A[i]
        A[i] = 0
        #print("{}体倒しました まだ余力が{}残っています".format(A[i],B[i])) 
        if(A[i + 1] < B[i]):
            #print("追加で{}体倒しました まだ余力が{}残っています".format(A[i + 1],B[i] - A[i + 1])) 
            Knock_Down += A[i + 1]
            B[i] -= A[i+1]
            A[i + 1] = 0
        elif(A[i + 1] >= B[i]):
            Knock_Down += B[i]
            A[i + 1] -= B[i]
            B[i] = 0
#print(A,B)
print(Knock_Down)
            

Measured memory_bytes: 28776
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<iomanip>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int inf = 1000000007;
int a[3];
signed main() {
	cin >> a[0] >> a[1] >> a[2];
	int wa = a[0] + a[1] + a[2];
	sort(a, a + 3);
	int sum = 0;
	if ((a[2] * 3) % 2 == wa % 2) {
		sum = a[2];
		if ((sum - a[1] + sum - a[0]) % 2 == 0)cout << (sum - a[1] + sum - a[0]) / 2 << endl;
		else cout << (sum - a[1] + sum - a[0]) / 2 + 1 << endl;
	}
	else{
		sum = a[2] + 1;
		if ((sum - a[1] + sum - a[0]) % 2 == 0)cout << (sum - a[1] + sum - a[0]) / 2 << endl;
		else cout << (sum - a[1] + sum - a[0]) / 2 + 1 << endl;
	}
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	lint ans=0;
	for(int D=1;D<n;D++){
		// sum1 = a[0]+a[D]+a[2D]+...+a[KD]
		// sum2 = a[A]+a[A+D]+a[A+2D]+...+a[A+KD]
		lint sum1=0,sum2=0;

		for(int k=1;;k++){
			int A=n-k*D-1;
			if(A<D) break;

			sum1+=a[k*D];
			sum2+=a[A];

			if(A%D==0 && A/D<=k) continue;

			ans=max(ans,sum1+sum2);
		}
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 768
#include<stdio.h>
int main(){
  int n,k;
  scanf("%d %d\n",&n,&k);
  long long int p=k;
  int i;
  for(i=1;i<=(n-1);i++){
    p = p*(k-1);
  }
  printf("%d\n",p);
  return 0;
}
  

Measured memory_bytes: 1696
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
#define ll long long
#define pp pair<int,int> 
const int INF = 1001001001;
//int 2×10の9乗

//vector<vector<int>> a(n, vector<int>(m));
  //rep(i,n) rep(j,m) cin >> a[i][j]; 
 
int main() {
  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;
  int cnt=1;
  rep(i,n-1) {
    if(s[i+1]!=s[i]) cnt++;
  }
  cnt-=2*k;
  int ans=min(n-cnt,n-1);
  cout << ans << endl;
}    

Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <sstream>
#include <set>
#include <string>
#include <math.h>
#include <map>
#include <climits>
#include <iomanip>


#define forn(i, n) for (int i = 0; i < int(n); i++)

#define ll long long

using namespace std;

void A();
void B();
void C();
void D();
void E();
void F();

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	B();


}

void A() {
	int n;
	cin >> n;

	double cir = n * 2 * 3.14159265358979323846;
	cout << setprecision(8) << cir << endl;
}
 
void B() {
	

	int n, m;
	cin >> n >> m;

	int sum = 0;
	forn(i, m) {
		int ss;
		cin >> ss;
		sum += ss;
	}

	if (sum > n) {
		cout << -1;
	}
	else {
		cout << (n - sum);
	}

	
}

void C() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}

void D() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}

void E() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}

void F() {
	int T;
	cin >> T;
	for (int t = 1; t <= T; t++) {

		int N;
		cin >> N;


		int result = 0;

		cout << "Case #" << t << ": ";

		cout << result << endl;

	}
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (1e9)
#define INFL (1e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[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; }

ll n;
int ans=0;
int dx[] = {3, 5, 7};

void dfs(ll x, vector<int> sft){
    int d = 1;
    rep(i, 3) d*=sft[i];
    if(d>0) ans++;

    ll t = x;
    rep(i, 3){
        if(10*x + dx[i] <= n){
            vector<int> next = sft;
            next[i]++;
            dfs(10*x + dx[i], next);
        }
    }
}

int main()
{
    cin >> n;
    vector<int> sft(3, 0);
    dfs(0, sft);
    pr(ans);
    return 0;}

Measured memory_bytes: 3520
let n = stdin.ReadLine() |> int
stdin.ReadLine().Split(' ')
    |> Array.map int
    |> Array.sort
    |> Array.rev
    |> Array.indexed
    |> Array.sumBy (fun (i, c) -> if i % 2 = 0 then c else -c )
    |> printfn "%d"


Measured memory_bytes: 14812
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <numeric>
#include <limits>
#include <type_traits>
using _loop_int = int;
#define REP(i,n) for(_loop_int i=0; i<(_loop_int)(n); i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a); i<(_loop_int)(b); i++)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1; i>=(_loop_int)(a); i--)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;


// Connected component(DFS)
void dfs(int n, int comp[], vector<int> G[]) {
  int i, j, vertex, neighbor, color[100000];
  REP(i, 100000) color[i] = 0;
  stack<int> S;

  for (i = 0; i < n; i++) color[i] = 0;

  for (i = 0; i < n; i++) {
    if (color[i] == 0) {

      S.push(i);
      while (!S.empty()) {
        vertex = S.top();
        S.pop();
        color[vertex] = 1;
        comp[vertex] = i;
        for (j = 0; j < (int) G[vertex].size(); j++) {
          neighbor = G[vertex][j];
          if (color[neighbor] == 0) S.push(neighbor);
        }
      }
    }
  }
}


struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> siz;

    UnionFind(int N) : par(N), siz(N, 1) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++){
          par[i] = i;
        }
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        siz[ry] += siz[rx];
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x){
      return siz[root(x)];
    }
};

int main(){
  ll N, tmp, all_p=0;
  cin >> N;

  ll a[N], c[N];
  REP(i, N) c[i] = 0;
  REP(i, N){
    cin >> a[i];
    c[a[i]-1]++;
  }
  REP(i, N){
    all_p += c[i]*(c[i]-1)/2;
  }

  REP(i, N) cout << all_p - c[a[i]-1] + 1 << endl;

  // REP(i, N) cout << c[i] << " ";
  // cout << endl;

  // REP(i, N) cout << a[i] << " ";
  // cout << endl;

  // cout << all_p << endl;

  return 0;
}


Measured memory_bytes: 5760
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int N, C, K; cin >> N >> C >> K;
  vector<int> T(N); cin >> T;
  sort(T.begin(),T.end());

  int cnt = 0, num = 0;
  int t = -1e9;
  for (int v : T) {
    if (t + K < v) {
      ++cnt;
      num = 0;
      t = v;
    } else if ((num + 1) % C == 0) {
      ++cnt;
      num = 0;
      t = v;
    } else {
      ++num;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right)
{
  int n1 = mid - left;
  int n2 = right - mid;
  for(int i=0;i<n1;i++) L[i]=A[left+i];
  for(int i=0;i<n2;i++) R[i]=A[mid+i];
  L[n1]=R[n2]=SENTINEL;
  int i=0,j=0;
  for(int k=left;k<right;k++)
  {
    cnt++;
    if(L[i]<=R[j])
    {
      A[k]=L[i++];
    }
    else
    {
      A[k]=R[j++];
    }
  }
}

void mergeSort(int A[],int n,int left,int right)
{
  if(left+1<right)
  {
  int mid = (left + right)/2;
  mergeSort(A,n,left,mid);
  mergeSort(A,n,mid,right);
  merge(A,n,left,mid,right);
  }
}

int main ()
{
  int A[MAX],n,i;
  cnt = 0;

  cin>>n;
  for(i=0;i<n;i++) cin>>A[i];

  mergeSort(A,n,0,n);

  for(i=0;i<n;i++)
  {
    if(i) cout << " ";
    cout << A[i];
  }
  cout << endl;

  cout << cnt << endl;

  return 0;
}



Measured memory_bytes: 6996
N, K = map(int, input().split())
if (N - 1) * (N - 2) // 2 < K:
    print(-1)
    quit()


ans = []
for i in range(1, N):
    ans.append((1, i+1))

now_K = (N - 1) * (N - 2) // 2


def f():
    global now_K
    for i in range(1, N):
        for j in range(i+1, N):
            if now_K == K:
                break
            ans.append((i+1, j+1))
            now_K -= 1
f()
print(len(ans))
for a, b in ans:
    print(a, b)


Measured memory_bytes: 3956
// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}



signed main(){
int r;
  cin >> r;
  cout << r * 2 * M_PI << endl;
    return 0;
}

Measured memory_bytes: 3776
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <stack>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int Max = 1000000;
int main(){
    string X;
    cin >> X;
    int l = X.size();

    stack<char> count;
    int ans = 0;

    for(int i=0;i<l;i++){
      if(!count.empty()){
        if(count.top()=='S' && X[i]=='T'){
          ans++;
          count.pop();
        }else{
          count.push(X[i]);
        }
      }else{
        count.push(X[i]);
      }
    }
    


    cout << l - 2*ans <<endl;

  	return 0;
}


Measured memory_bytes: 644
import sys


def solve(x):
    return (x - k) * (n // x) + max(0, n % x - k + 1)


n, k = map(int, input().split())

if k == 0:
    print(n**2)
    sys.exit()


ans = 0
for i in range(k + 1, n + 1):
    ans += solve(i)

print(ans)

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

int main() {
  string s;
  cin >> s;
  if(s[0]==s[s.length()-1]){
    if(s.length()%2==0)cout << "First";
    else cout << "Second";
  }
  else{
    if(s.length()%2==0)cout << "Second";
    else cout << "First";
  }
}


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

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;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
    string A,B;
    cin>>A>>B;
    bool ok=true;
    for(int i=0;i<3;i++){
        if(A[i]!=B[2-i])ok=false;
    }
    if(ok)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

//a=97,z=122

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

using std::cout;
using std::cin;
using std::endl;
using std::pow;
using std::vector;
using std::string;

int main(){
    long n,res=0;
    bool nao;
    int i;
    string s;
    cin >> n;
    cin >> s;
    for(i=0;i<1000;i++){
        int j=0,k=0;
        while(j<n){
            if(int(s[j])-48 == i/100 && k == 0) k++;
            else if(int(s[j])-48 == (i/10)%10 && k == 1) k++;
            else if(int(s[j])-48 == i%10 && k == 2) k++;
            if(k == 3){
                res++;
                k++;
            }
            j++;
        }
    }
    cout << res;
}

Measured memory_bytes: 3688
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n; cin >> n;
	int amt = 0;
	forl(i, 1, n+1) {
		if(i%2) amt++;
	}
	println((double)amt/n);
}


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

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

  vector<int> a;

  for (int i = 0; i < N; i++) {
    int z;
    cin >> z;
    z--; // 0-indexed
    a.push_back(z);
  }
  
  int now = 0, c = 0;
  for(;;) {
    if (now == 1) {
      cout << c << endl;
      break;
    }
    if (c >= N)
    {
      cout << -1 << endl;
      break;
    }
    c++; // ボタンを押す
    now = a.at(now); // 次のボタンが光る
  }
}

Measured memory_bytes: 892
#include<stdio.h>



int main(void){

  long long int a, b;
  long long int x, y;
  long long int m;
  long long int ans1, ans2;

  while(scanf("%lld %lld", &a, &b)!=EOF){
    if(a>b){
      x = a;
      y = b;
    }
    else{
      x = b;
      y = a;
    }

    
    while(x%y != 0){
      m = y;
      y = x%y;
      x = m;
    }

    ans1 = y;
    ans2 = (a/ans1)*b;
    printf("%lld %lld\n", ans1, ans2);
      
  }

  return(0);

}



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

int N, A_temporal;
vector<int> A;
vector<int> step1;
vector<int> step1_cumsum;
vector<int> step2;

inline int distance(int x0, int x1) {
  return abs(x0 - x1);
}

template <typename T>
void print(const vector<T>& xs) {
  for (T x : xs) {
    cout << x << ", ";
  }
  cout << endl;
}

int main() {
  cin >> N;
  
  A.push_back(0);  // start
  for (int i = 1; i <= N; ++i) {
    cin >> A_temporal;
    A.push_back(A_temporal);
  }
  A.push_back(0);  // goal
  
  step1.push_back(0);
  for (int i = 1; i <= N + 1; ++i) {
    step1.push_back(distance(A[i - 1], A[i]));
  }
  
  step1_cumsum.push_back(0);
  for (int i = 1; i < step1.size(); ++i) {
    step1_cumsum.push_back(step1_cumsum[i - 1] + step1[i]);
  }
  
  step2.push_back(-1);
  step2.push_back(-1);
  for (int i = 2; i <= N + 1; ++i) {
    step2.push_back(distance(A[i - 2], A[i]));
  }
  
  for (int i = 1; i <= N; ++i) {
    int before = step1_cumsum[i - 1];
    int after = step1_cumsum[N + 1] - step1_cumsum[i + 1];
    cout << before + step2[i + 1] + after << endl;
  }
}


Measured memory_bytes: 2936
#include<bits/stdc++.h>  
using namespace std;     
#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(int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
                         
#define pb push_back     
#define PII pair<int,int>
                         
#define VS vector<string>
#define VI vector<int>   
#define ll long long int 
#define debug(x) cout << x << " :" <<#x << endl  
int main(void) {         
    int n = 0;           
    cin >> n;            
    VI in;               
    int a = 0;           
    REP(i,n) {           
        cin >> a;        
        in.pb(a);        
    }                    
    sort(in.begin(), in.end());
    int tmp = in[0];     
    int sum = 0;         
    int number = 1;      
    FOR(i,1,n) {         
        if(in[i] == tmp) {
            number++;    
        } else {         
            if(number % 2) sum++;
            number = 1;  
        }                
        tmp = in[i];     
    }                    
    if(number % 2) sum++;                                                                            
    cout << sum << endl; 
} 

Measured memory_bytes: 892
#include <stdio.h>

int main(void)
{
	int n;
	int i,j,k,l;
	int a[10]={},b[10]={},c[10]={},d[10]={};
	int count=0;
	while(scanf("%d",&n)!=EOF){
	for(i=0;i<10;i++){
		a[i]=i;
		b[i]=i;
		c[i]=i;
		d[i]=i;
	}
	for(i=0;i<10;i++){
		for(j=0;j<10;j++){
			for(k=0;k<10;k++){
				for(l=0;l<10;l++){
					if(a[i]+b[j]+c[k]+d[l]==n){
						count=count+1;
					}
				}
			}
		}
	}
	printf("%d\n",count);
	count=0;
	}
	return 0;
}

Measured memory_bytes: 596
a, b = list(map(int, input().split()))

pa = [[] for i in range(110)]
pb = [[] for i in range(111)]

for i in range(1251):
  pa[int(i*0.08)].append(i)
  
for i in range(1101):
  pb[int(i*0.10)].append(i)
  
na = pa[a]
nb = pb[b]

for ca in na:
  if ca in nb:
    print(ca)
    exit()

print(-1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define per(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define MP make_pair

typedef double db;

const db EPS = 1e-8;

inline int sign(db a) {
	return a < -EPS ? -1 : a > EPS;
}

inline int cmp(db a, db b){
	return sign(a-b);
}

struct P {
	db x, y;
	P() {
	}
	P(db _x, db _y) :
			x(_x), y(_y) {
	}
	P operator+(P p) {
		return P(x + p.x, y + p.y);
	}
	P operator-(P p)  {
		return P(x - p.x, y - p.y);
	}
	P operator*(db d) {
		return P(x * d, y * d);
	}
	P operator/(db d) {
		return P(x / d, y / d);
	}
	bool operator<(P p) const {
		int c = sign(x - p.x);
		if (c)
			return c == -1;
		return sign(y - p.y) == -1;
	}
	db dot(P p) {
		return x * p.x + y * p.y;
	}
	db det(P p) {
		return x * p.y - y * p.x;
	}
	db distTo(P p) { return (*this-p).abs(); }

	db alpha() {
		return atan2(y, x);
	}
	void read() {
		cin>>x>>y;
	}
	db abs() {
		return sqrt(abs2());
	}
	db abs2() {
		return x * x + y * y;
	}
	P rot90(){
		return P(-y,x);
	}
};

#define cross(p1,p2,p3) ((p2.x-p1.x)*(p3.y-p1.y)-(p3.x-p1.x)*(p2.y-p1.y))
#define crossOp(p1,p2,p3) sign(cross(p1,p2,p3))

P isLL(P p1, P p2, P q1, P q2) {
	db a1 = cross(q1, q2, p1), a2 = -cross(q1, q2, p2);
	return (p1 * a2 + p2 * a1) / (a1 + a2);
}

bool intersect(db l1,db r1,db l2,db r2){
	if(l1>r1) swap(l1,r1); if(l2>r2) swap(l2,r2); 
	return !( cmp(r1,l2) == -1 || cmp(r2,l1) == -1 );
}

bool isSS(P p1, P p2, P q1, P q2){
    return intersect(p1.x,p2.x,q1.x,q2.x) && intersect(p1.y,p2.y,q1.y,q2.y) && 
    crossOp(p1,p2,q1) * crossOp(p1,p2,q2) <= 0 && crossOp(q1,q2,p1)
            * crossOp(q1,q2,p2) <= 0;
}

bool isMiddle(db a, db m, db b) {
    return sign(a - m) == 0 || sign(b - m) == 0 || (a < m != b < m);
}
 
bool isMiddle(P a, P m, P b) {
    return isMiddle(a.x, m.x, b.x) && isMiddle(a.y, m.y, b.y);
}

bool onSegment(P p1, P p2, P q){
	return crossOp(p1,p2,q) == 0 && isMiddle(p1, q, p2);
}

P proj(P p1, P p2, P q) {
    P dir = p2 - p1;
    return p1 + dir * (dir.dot(q - p1) / dir.abs2());
}

P reflect(P p1, P p2, P q){
	return proj(p1,p2,q) * 2 - q;
}

db nearest(P p1,P p2,P q){
	P h = proj(p1,p2,q);
	if(isMiddle(p1,h,p2))
		return q.distTo(h);
	return min(p1.distTo(q),p2.distTo(q));
}

db disSS(P p1, P p2, P q1, P q2){
	if(isSS(p1,p2,q1,q2)) return 0;
	return min(min(nearest(p1,p2,q1),nearest(p1,p2,q2)), min(nearest(q1,q2,p1),nearest(q1,q2,p2)) );
}

db getrad(P p1,P p2){
	return atan2l(p1.det(p2),p1.dot(p2));
}

db incircle(P p1, P p2, P p3){
	db A = p1.distTo(p2);
	db B = p2.distTo(p3);
	db C = p3.distTo(p1);
	return sqrtl(A*B*C/(A+B+C));
}

db area(vector<P> ps){
	db ret = 0; rep(i,0,ps.size()) ret += ps[i].det(ps[(i+1)%ps.size()]); 
	return abs(ret/2);
}

int main(){
	int n;cin>>n;
	vector<P> ps(n);
	rep(i,0,n) ps[i].read();
	bool ok = 1;
	rep(i,0,n) ok &= crossOp(ps[i],ps[(i+1)%n],ps[(i+2)%n])>=0;
	printf("%d\n",ok);
	return 0;
}

Measured memory_bytes: 3280
s = input()
q = int(input())

trans = False
s2 = ''
for i in range(q):
    query = input().split()
    if(query[0] == '1'):
        trans = not trans
    else:
        if(trans):
            if(query[1] == '1'):
                s = s + query[2]
            else:
                s2 = s2 + query[2]
        else:
            if(query[1] == '1'):
                s2 = s2 + query[2]
            else:
                s = s + query[2]

s2 = s2[::-1]
s = s2 + s
if(trans):
    s = s[::-1]
print(s)

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


int main (void)
{
  int n,x,i,a,d,b,GCD;
  cin>>n>>x;
  for(i=0;i<n;i++)
  {
    cin>>a;
    if(i==0){GCD=abs(a-x);}
    else
    {
      b=abs(a-x);
      d=b%GCD;
      while(d!=0)
      {
        b=GCD;
        GCD=d;
        d=b%GCD;
      }
    }
  }
  cout<<GCD<<endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include <math.h>

using namespace std;

int main(void){
    double h1 ,h2 ,x;
    int rectangle= 0 ,rhombus= 0;
    char dummy;
    
    while ( cin>>h1>>dummy>>h2>>dummy>>x )
    {
        if (h1==h2) rhombus++;
        if (hypot(h1, h2)==x) rectangle++;
    }
    
    cout<<rectangle<<endl<<rhombus<<endl;
    
    return 0;
}

Measured memory_bytes: 1236
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const long double EPS = 1E-10;

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



int main(){
    int dx[4] = {0, -1, 0, 1};
    int dy[4] = {1, 0, -1, 0};
    int H, W; std::cin >> H >> W;
    std::vector<std::string> S(H);
    for(int i(0); i < H; ++i) std::cin >> S[i];
    int ans(0);
    for(int i(0); i < H; ++i){
        for(int j(0); j < W; ++j){
            if(S[i][j] == '#') continue;
            std::vector<std::vector<int>> d(H, std::vector<int>(W, -1));
            std::queue<std::pair<int, int>> que;
            que.emplace(i, j);
            d[i][j] = 0;
            while(!que.empty()){
                std::pair<int, int> p(que.front()); que.pop();
                chmax(ans, d[p.first][p.second]);
                for(int k(0); k < 4; ++k){
                    int ni(p.first + dx[k]), nj(p.second + dy[k]);
                    if(0 <= ni && ni < H && 0 <= nj && nj < W
                       && S[ni][nj]=='.' && d[ni][nj] == -1){
                        d[ni][nj] = d[p.first][p.second] + 1;
                        que.emplace(ni, nj);
                    }
                }
                
            }
        }
    }
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
    int i, n;
    i = 1;
    scanf("%d", &n);
    while (i <= n)
    {
        int x = i;
        if (x % 3 == 0)  // 割り切れる時
        {
            printf(" %d", i); // 出力する
        }
        else
        {
            while (1) // 分岐2
            {
                if (x % 10 == 3) // 1桁目が3か? 3余る時
                {
                    printf(" %d", i); // 出力
                    break; // ループ抜ける
                }
                x /= 10; // 10で割ることで一桁落とす
                if (x == 0)  // 答えがゼロになった時 
                {
                    break;
                }
            }
        }
        i++; // 足してループ
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2048
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

N,K = LI()
R,S,P = LI()
T = list(input())
dp = [[0]*3 for _ in range(N+1)]

def main():
    for i in range(1,N+1):
        if i<K:
            if T[i-1] == 's':
                dp[i] = [R,0,0]
            if T[i-1] == 'p':
                dp[i] = [0,S,0]
            if T[i-1] == 'r':
                dp[i] = [0,0,P]
        else:
            dp[i][0] = max(dp[i-K][1],dp[i-K][2])
            dp[i][1] = max(dp[i-K][0],dp[i-K][2])
            dp[i][2] = max(dp[i-K][0],dp[i-K][1])
            if T[i-1] == 's':
                dp[i][0] += R
            if T[i-1] == 'p':
                dp[i][1] += S
            if T[i-1] == 'r':
                dp[i][2] += P
    ans = 0
    for i in range(K):
        ans += max(dp[N-i])
    print(ans)


if __name__ == "__main__":
    main()


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

#define     F       first
#define     S       second
typedef pair<int, int>  pi;
typedef long long       ll;

const int MAX=2e3+9;
int x, y, a, b, c;
multiset<int> v1, v2;
vector<int> v3;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> x >> y >> a >> b >> c;
    for (int i=0; i<a; ++i) {
        int z;
        cin >> z;
        v1.insert(z);
    }

    for (int i=0; i<b; ++i) {
        int z;
        cin >> z;
        v2.insert(z);
    }

    for (int i=0; i<c; ++i) {
        int z;
        cin >> z;
        v3.push_back(z);
    }

    while (v1.size()>x)     v1.erase(v1.begin());
    while (v2.size()>y)     v2.erase(v2.begin());

    sort(v3.begin(), v3.end(), greater<int>());

    for (int i=0; i<c; ++i) {
        int can1=v3[i]-(*v1.begin()),
            can2=v3[i]-(*v2.begin());

        if (can1>0 && can1>=can2) {
            v1.erase(v1.begin());
            v1.insert(v3[i]);
        }
        else if (can2>0 && can2>can1) {
            v2.erase(v2.begin());
            v2.insert(v3[i]);
        }
        else {
            break;
        }
    }

    ll ans=0;
    for (auto it=v1.begin(); it!=v1.end(); ++it)        ans+=*it;
    for (auto it=v2.begin(); it!=v2.end(); ++it)        ans+=*it;

    cout << ans;

    return 0;
}


Measured memory_bytes: 10236
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	map<int,bool>MAP;

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

	int tmp;
	for(int loop = 0; loop < N; loop++){
		scanf("%d",&tmp);
		MAP[tmp] = true;
	}

	int M;
	scanf("%d",&M);

	bool FLG = true;

	for(int loop = 0; loop < M; loop++){

		scanf("%d",&tmp);
		if(!FLG)continue;

		auto at = MAP.find(tmp);

		if(at == MAP.end()){
			FLG = false;
		}
	}

	if(FLG){
		printf("1\n");
	}else{
		printf("0\n");
	}


	return 0;
}



Measured memory_bytes: 12524
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
typedef long long ll;
#define all(x) (x).begin(), (x).end()  // sortなどの引数を省略
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define max3(x, y, z) max(x, max(y, z))

#ifdef _MSC_FULL_VER  //デバッグ出力
#define dout cout
#define debug() if (true)
#define check(x) std::cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) std::cout << "☆" << x << endl
#else
#define dout \
  if (false) cout
#define debug() if (false)
#define check(x) \
  if (false) cout << "★" << #x << "の値:" << (x) << endl
#define pass(x) \
  if (false) cout << "☆" << x << endl
#endif
using namespace std;
int main() {
  string a;
  cin >> a;
  for (int i = 0; i < a.length(); i++) {
    if (a[i] != a[a.length()-1 - i]) {
      cout << "No";
      return 0;
    }
  }
  for (int i = 0; i < (a.length()-1)/2; i++) {
    if (a[i] != a[(a.length()-1)/2 - 1 - i]) {
      cout << "No";
      return 0;
    }
  }
  string b = a.substr((a.length() + 3) / 2 - 1, a.length()-(a.length()+3)/2+1);
  for (int i = 0; i < b.length(); i++) {
    if (b[i] != b[b.length() - 1 - i]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
  return 0;
}
/*
//よく使うやつ
int N;
cin >> N;
vector<int> list(N);
for (int i = 0; i < N; i++) {
cin >> list[i];
}
// for文
for (int i = 0; i < N; i++) {
}
//配列
vector<int> list;
list.at(i)
vector<vector<int>> list(10, vector<int>(10));
sort(all(list));
sort(all(list), greater<int>());
  //配列の内容表示
dout << "====listの内容====\n";
for (int i = 0; i < N; i++) dout << list[i] << endl;
dout << "====ここまで====\n";
*/


Measured memory_bytes: 256
#include<iostream>
#include<stdlib.h>
#include<string>
#include<vector>
#include<algorithm>
#include<stdlib.h>
using namespace std;
#define MAX 11451
int main(){
  int x,y;
  cin>>x>>y;
  int z=x+y*0.5;
  cout<<z<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>

using namespace std;
#define ll long long
#define ve vector
#define umap unordered_map

int main() {
    ll n, k;
    cin>>n>>k;
    ll ans = k;
    while (--n) ans *= k - 1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef pair<int,ii> iii;
typedef pair<int, iii> iiii;
typedef pair<double, ii> dii;
typedef long long ll;
typedef pair<ll, ii> lii;
const int INF = 1000000000;
const double EPS = 1e-9;
#define LSOne(S) (S & (-S))
int mods(int a, int b) { return (b + (a%b)) % b; }

int n, mx, a[3], dp[3], new_dp[3];
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
 
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    cin >> n;

    for (int i = 0; i < n; i++) {
        memset(new_dp, 0, sizeof(new_dp));
        cin >> a[0] >> a[1] >> a[2];
        for (int j = 0; j < 3; j++)
            for (int k = 0; k < 3; k++)
                if (j != k) new_dp[k] = max(new_dp[k], dp[j] + a[k]);
        for (int j = 0; j < 3; j++)
            dp[j] = new_dp[j];
    }

    for (int i = 0; i < 3; i++)
        mx = max(mx, dp[i]);

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


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val s = readLine()!!
    val t = readLine()!!

    val gcd = gcd(n,m)
    val lcm = 1L*n/gcd*m

    val a = s.slice((0..n-1) step n/gcd)
    val b = t.slice((0..m-1) step m/gcd)
    if(a == b) {
        println(lcm)
    } else {
        println(-1)
    }
}

fun gcd(a: Int, b: Int): Int {
    if (b == 0) return a
    return gcd(b, a % b)
}

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

int main(){
    int n, ans = 0, m = 0;
    cin >> n;
    int a[100];
    for (int i = 0; i < n; i++){
        cin >> a[i];
        if (m < a[i])m = a[i];
        ans += a[i];
    }
    cout << ans - m / 2 << endl;
}

Measured memory_bytes: 256
N,X,Y=map(int, input().split())

D=[0]*(N-1)

for i in range(1,N):
  for j in range(i+1,N+1):
    d=min(abs(i-j),abs(X-i)+1+abs(Y-j),abs(X-j)+1+abs(Y-i))
    D[d-1]+=1
    #print(i,j,d)
for i in range(len(D)):
  print(D[i])

Measured memory_bytes: 3444
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>

using namespace std;

long long g = 0;
long long L;

class T {
public:
  T *l, *r;
  int dep;
  T(int d, string &s) {
    l = r = nullptr;
    dep = d;
    if (d == s.size()) {
    } else {
      if (s[d] == '0') {
        l = new T(d + 1, s);
      } else {
        r = new T(d + 1, s);
      }
    }
  }
  ~T() {
    if (l != nullptr) {
      delete l;
    }
    if (r != nullptr) {
      delete r;
    }
  }
  void append(string &s) {
    if (s.size() == dep) {
      return;
    }
    if (s[dep] == '0') {
      if (l == nullptr) {
        l = new T(dep + 1, s);
      } else {
        l->append(s);
      }
    } else {
      if (r == nullptr) {
        r = new T(dep + 1, s);
      } else {
        r->append(s);
      }
    }
  }
  void solve() {
    if (l == nullptr && r == nullptr) {
      return;
    } else {
      if (l != nullptr)
        l->solve();
      if (r != nullptr)
        r->solve();
      if (l == nullptr || r == nullptr) {
        int r = 0;
        while ((((L - dep) >> r) & 1) == 0)
          r++;
        g ^= (1 << r);
      }
    }
  }
};

int main() {
  int n;
  cin >> n >> L;
  vector<string> v(n);
  for (int i = 0; i < n; i++)
    cin >> v[i];
  T t(0, v[0]);
  for (int i = 1; i < n; i++)
    t.append(v[i]);
  t.solve();
  if (g == 0)
    cout << "Bob" << endl;
  else
    cout << "Alice" << endl;

  return 0;
}


Measured memory_bytes: 6144
#include<iostream>
#include<string>
#include<cstring>
#include<string.h>
#include<stack>
using namespace std;
int main()
{
	stack<int> p;
	string x;
	cin>>x;
	int t=x.length();
	int sum;
	for(int i=0;i<t;i++)
	{
		if(x[i]=='T')
		{
			if(p.empty()||p.top()==1)
			{
				p.push(1);
			}
			else
			{
				p.pop();
			}
		}
		if(x[i]=='S')
		{
			p.push(0);
		}
	}
	cout<<p.size()<<endl;
	return 0;
} 

Measured memory_bytes: 1284
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            const int MAX = 50176;

            bool[] isPrime = Enumerable.Repeat(true, MAX).ToArray();
            int sqrtMAX = (int)Math.Sqrt(MAX);

            isPrime[0] = isPrime[1] = false;

            for (int i = 2; i <= sqrtMAX; i++)
            {
                if (!isPrime[i]) continue;

                for (int j = i * i; j < MAX; j += i)
                {
                    isPrime[j] = false;
                }
            }

            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                int n = int.Parse(input);
                int small = n - 1;
                int large = n + 1;

                while (isPrime[small] == false) small--;
                while (isPrime[large] == false) large++;

                sb.AppendLine(small + " " + large);
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9604
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(pos,mp) for(ll pos=mp.begin();pos!=mp.end();pos -++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;

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

    vector<vector<ll>> a(n, vector<ll>(n-1));
    rep(i, n)rep(j, n-1){
        cin >> a[i][j];
        a[i][j]--;
    }

    ll ans = 0;
    while(true){
        bool isok = false;
        bool used[n] = {};
        rep(i, n){
            if(used[i] || a[i].empty())continue;
            
            ll cmp = a[i][0];
            if(a[cmp].empty()){
                isok = false;
                break;
            }

            if(i == a[cmp][0] && !used[cmp]){
                isok = true;

                used[i] = true;
                used[cmp] = true;

                a[i].erase(a[i].begin());
                a[cmp].erase(a[cmp].begin());
            }
        }

        if(!isok)break;

        ans++;
    }

    bool ispossible = true;
    rep(i, n)if(!a[i].empty()){
        ispossible = false;
        break;
    }

    if(ispossible)cout << ans << endl;
    else cout << -1 << endl;
}

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

int main() {
 
  int N;
  cin >> N;
  bool k = false;
  vector<vector<int>> sai(N, vector<int>(2));
  
 for(int i = 0; i < N; i++){
   for (int j = 0; j < 2; j++){
  cin >> sai.at(i).at(j);
} }
  for(int i = 0; i < N-2; i++){
    if(sai.at(i).at(0) == sai.at(i).at(1) && sai.at(i+1).at(0) == sai.at(i+1).at(1)
       && sai.at(i+2).at(0) == sai.at(i+2).at(1) )
    {cout << "Yes" << endl;
     k = true;
     break;
    } }
    if (k == false){
      cout << "No" << endl;
    }
  
} 

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


int main(){
	LL n;
	cin >> n;
	vector<int> q;
	for(int i = 1; i <= 100; i++){
		q.push_back(i);
	}
	vector<int> r;
	for(LL i = 0; i < 100; i++){
		if(n == 0) break;
		LL g = 1;
		LL num = 0;
		for(int f = 0; f < i; f++){
			if(g * 2 > n) break;
			g *= 2;
			num ++;
		}
		n -= g;
		for(int f = 0; f < r.size(); f++){
			if(r[f] >= num + 1) r[f]++;
		}
		r.push_back(num+1);
	}
	for(int i = 0; i < r.size(); i++){
		q.push_back(r[i]);
	}
	cout << q.size() << endl;
	for(int i = 0; i < q.size(); i++){
		cout << q[i] << " ";
	}
	cout << endl;
}

Measured memory_bytes: 256
use std::cmp::*;
use std::io::*;

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();

    let xy: Vec<(i64, i64)> = (0..n)
        .map(|_| {
            (
                itr.next().unwrap().parse().unwrap(),
                itr.next().unwrap().parse().unwrap(),
            )
        })
        .collect();

    let mut ans = 1i64 << 62;
    for i in 0..n {
        for j in i + 1..n {
            for a in 0..n {
                for b in a + 1..n {
                    let x1 = min(xy[i].0, xy[j].0);
                    let x2 = max(xy[i].0, xy[j].0);
                    let y1 = min(xy[a].1, xy[b].1);
                    let y2 = max(xy[a].1, xy[b].1);
                    let mut cnt = 0;
                    for ii in 0..n {
                        let x = xy[ii].0;
                        let y = xy[ii].1;
                        if x1 <= x && x <= x2 && y1 <= y && y <= y2 {
                            cnt += 1;
                        }
                    }
                    if cnt >= k {
                        ans = min(ans, (y2 - y1) * (x2 - x1));
                    }
                }
            }
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <stdio.h>

main(){
  int h, x;
  int data[11];

  h=0;
  while(1){
    if(scanf("%d", &x)==EOF) break;
    if(x==0){
      printf("%d\n", data[h-1]);
      h-=1;
    }
    else{
      data[h]=x;
      h++;
    }
  }
  return 0;
}

Measured memory_bytes: 0
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [map(int, input().split()) for _ in range(m)]
a,b = [list(i) for i in zip(*ab)]
Max = []
for i in range(n):
    Max.append(0)
# print(Max)
ans = 0
for i in range(m):
    Max[a[i]-1] = max(Max[a[i]-1],h[b[i]-1])
    Max[b[i]-1] = max(Max[b[i]-1],h[a[i]-1])

for i in range(n):
    if h[i] > Max[i]:
        ans += 1
print(ans)

Measured memory_bytes: 66828
N = int(input())
Vs = list(map(int,input().split()))
Cs = list(map(int,input().split()))


def calc(v_sum,c_sum,index):
    if index == N:
        return v_sum - c_sum

    return max(calc(v_sum + Vs[index], c_sum + Cs[index], index + 1),calc(v_sum, c_sum, index + 1))


print(calc(0,0,0))


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

int main() {
    int n;

    int primes[300001] = {};
    primes[0] = primes[1] = 1;
    for(int i=2; i<=300000; ++i) {
        if(i%7 == 1 || i%7 == 6) {
            if(primes[i]) continue;
            for(int j=6; i*j<=300000; ++j) {
                if(j%7 == 1 || j%7 == 6) primes[i*j] = 1;
            }
        }else primes[i] = 1;
    }

    while(cin>>n) {
        if(n == 1) break;
        vector<int> ans;
        for(int i=6; i<=n; ++i) {
            if(primes[i]) continue;
            if(n%i == 0) ans.push_back(i);
        }

        cout<<n<<": ";
        for(int i=0; i<ans.size()-1; ++i) cout<<ans[i]<<" ";
        cout<<ans[ans.size()-1]<<endl;
    }
}

Measured memory_bytes: 2076
#include <iostream>
#include <string>

using namespace std;

int main() {

    string str;
    int n;

    cin >> str;
    cin >> n;

    while (n-- > 0) {

        string q, p;
        int a, b, size;

        cin >> q;
        cin >> a >> b;
        size = b - a + 1;

        if (q == "print") {
            cout << str.substr(a, size) << endl;
        } else if (q == "reverse") {
            string sub = str.substr(a, size);
            for (int i = a, i_ = sub.length() - 1; i_ < sub.length(); ++i, --i_) {
                str[i] = sub[i_];
            }
        } else {
            cin >> p;
            str.replace(a, size, p);
        }
    }
}

Measured memory_bytes: 3204
/** @Date    : 2017-08-20 20:17:41
  * @FileName: D.cpp
  * @Platform: Windows
  * @Author  : Lweleth (SoungEarlf@gmail.com)
  * @Link    : https://github.com/
  * @Version : $Id$
  */
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int ,int>
#define MP(x, y) make_pair((x),(y))
#define fi first
#define se second
#define PB(x) push_back((x))
#define MMG(x) memset((x), -1,sizeof(x))
#define MMF(x) memset((x),0,sizeof(x))
#define MMI(x) memset((x), INF, sizeof(x))
using namespace std;

const int INF = 0x3f3f3f3f;
const int N = 1e5+20;
const double eps = 1e-8;
const LL mod = 1000000007;
char a[2][100];

int main()
{
	int n;
	while(cin >> n)
	{
		scanf("%s%s", a[0], a[1]);

		int flag = 1;//横
		LL ans = 0;
		if(a[0][0] == a[1][0])
			flag = 0, ans = 3;
		else 
			ans = 6;
		//cout << flag;
		for(int i = 1 + flag; i < n; i++)
		{
			if(a[0][i] == a[1][i])//竖
			{
				//cout << "~";
				if(flag == 0)
				{
					ans = (ans * 2 % mod + mod) % mod;
				}
				else if(flag == 1)
				{
					ans = (ans * 1 % mod + mod) % mod;
				}
				flag = 0;
			}
			else//横
			{
				if(flag == 1)
					ans = (ans * 3 % mod + mod) % mod;
				else ans = (ans * 2 % mod + mod) % mod;
				i++;
				flag = 1;
			}
			//cout << flag << (flag?" ":"");
		}//cout<<endl;
		printf("%lld\n", ans);
	}
    return 0;
}

Measured memory_bytes: 256
S = input()

if S[0] == S[1] and S[2] == S[3] and S[1] != S[2]:
    print("Yes")
    exit()
if S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
    print("Yes")
    exit()
if S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
    print("Yes")
    exit()

print("No")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }

const int MAX_H = 100;
const int MAX_W = 100;
int H, W;
char C[MAX_H][MAX_W + 1];

void _main() {
  cin >> H >> W;
  rep(i, 0, H) cin >> C[i];
  rep(i, 0, H) {
    cout << C[i] << "\n";
    cout << C[i] << "\n";
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
	using namespace std;
	#define sim template < class c
	#define ris return * this
	#define dor > debug & operator <<
	#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
	sim > struct rge { c b, e; };
	sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
	sim > auto dud(c* x) -> decltype(cerr << *x, 0);
	sim > char dud(...);
	struct debug {
	#ifdef LOCAL
	~debug() { cerr << endl; }
	eni(!=) cerr << boolalpha << i; ris; }
	eni(==) ris << range(begin(i), end(i)); }
	sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
	}
	sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
	}
	#else
	sim dor(const c&) { ris; }
	#endif
	};
	#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
	#define lel debug()
	#define kek(...) lel << " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
	#define ll long long
	#define all(x) (x).begin(), (x).end()
	extern ll mod;
	ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;} 
	// 
using namespace std;
const int N = 400005;
ll mod = 1e9 + 7;


int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll n, m;
	cin >> n >> m;
	int ile = 0;
	ll sum = 0;
	vector<ll> tab(n + 3);
	for (int a = 1; a <= n; a++) {
		cin >> tab[a];
		sum += tab[a];
	}
	for (int a = 1; a <= n; a++) {
		if (4 * m * tab[a] >= sum) ile++;
	}

	if (ile >= m) {
		cout << "Yes";
	} else {
		cout << "No";
	}
	cout << endl;

	return 0;

}

Measured memory_bytes: 256