akhauriyash/Code-Regression huggingface dataset:
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
*$* WRITER:kakitamasziru/OxOmisosiru *$*
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <limits>//setprecision
#include <iomanip>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set,multiset
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
#include <bitset> // bitset
#include <numeric> //accumulate,,,
//#define endl "\n";
using namespace std;

const long long INF = 4000000000000000001;
const int inf = 1001001001;
long long MOD = 998244353;

void chmax(long long &a,long long b){if(a < b) a = b;}
void chmin(long long &a,long long b){if(a > b) a = b;}

//Solve N^M. This, mod_pow use Iterative Square Method.
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //When end-of-a bit is 1, times simple N.
    if (M & 1) res = (res * N) % MOD;
    return res %= MOD;
}
long long gcd(long long a, long long b) {
    if (b == 0) return a; else return gcd(b, a % b);
}
long long lcm(long long a, long long b) {
    return a / gcd(a, b) * b ;
}



int main() {
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    
    long long N;cin >> N;int Q;cin >> Q;
    long long black = (N-2)*(N-2);
    vector<long long> cnt_black_tate(N+1,N-2),cnt_black_yoko(N+1,N-2);
    cnt_black_tate.at(1) = 0,cnt_black_yoko.at(1) = 0;cnt_black_tate.at(N) = 0,cnt_black_yoko.at(N) = 0;
    //上辺と左辺に連結するような黒のところのみ、今後に影響する
    long long UP = N,LEFT = N;
    //vector<long long> ans;
    for(int i = 0;i<Q;i++){
        int type;cin >> type;
        if(type == 1){
            long long x;cin >> x;
            if(x < LEFT){
                black -= UP-2;
                //左辺の今後に影響しないやつは確定させてしまう
                for(int j = x;j<LEFT;j++){
                    cnt_black_tate.at(j) = UP-2;
                }
                LEFT = x;
            }
            else if(x > LEFT){
                black -= cnt_black_tate.at(x);
            }
        }
        if(type == 2){
            long long x;cin >> x;
            if(x < UP){
                black -= LEFT-2;
                //上辺の今後に影響しないやつは確定させてしまう
                for(int j = x;j<UP;j++){
                    cnt_black_yoko.at(j) = LEFT-2;
                }
                UP = x;
            }
            else if(x > UP){
                black -= cnt_black_yoko.at(x);
            }
        }
        //ans.push_back(black);
    }
    //for(long long V : ans) cout << V << endl; 
    cout << black << endl;
}


Measured memory_bytes: 6324
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
    {
        int t,a,b;
        cin >> t >> a >> b;
        if(a+b>t||(a+b)%2!=t%2)
        {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>

using namespace std;
int main()
{
    int n;
    cin >> n;
    char c;
    bool b = false;
    for(int i = 0; i < n; ++i) {
        cin >> c;
        if (c == 'Y') {
            b = true;
            break;
        }
    }
    cout << (b ? "Four" : "Three") << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main(){
    int N,K,ans=0;
    scanf("%d %d",&N,&K);
    int d[K],A[K][N];
    char flag[N];
    for(int i = 0;i<N;i++) flag[i] = 1;
    for(int i = 0;i<K;i++){
        scanf("%d",&d[i]);
        for(int j = 0;j<d[i];j++){
            scanf("%d",&A[i][j]);
            flag[A[i][j]-1] = 0;
        }
    }
    for(int i = 0;i<N;i++) ans += flag[i];
    printf("%d\n",ans);
    return 0;
}

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

#define ll long long

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

    int len;
    cin >> len;

    vector <int> arr(len+1);
    for(int i=0;i<len;i++){
        cin >> arr[i];
    }
    ll ans = 0;
    for(int i=0;i<len-1;i++){
        if(arr[i] > arr[i+1]){
            int temp = arr[i] - arr[i+1];
            arr[i+1] += temp;
            ans += temp;
        }
    }
//    for(int i=0;i<len;i++){
//        cout <<"sdfsd" << arr[i]<<endl;
//    }
    cout << ans <<"\n";
}


Measured memory_bytes: 3984
#include <iostream>
using namespace std;
#define ABS(X) ((X)<0?-(X):(X))

int main(void){
  int n,sp=0;
  char s[128];
  
  cin >> n;
  if (n==0){
    cout << "0" << endl;
    return 0;
  }
  while (n){
    s[sp++] = ABS(n)%2;
    //cout << n << endl;
    n -= ABS(n)%2;
    n/=-2;
  }
  while(sp){
    cout << (char)(s[--sp]+'0');
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long double A,B,H,M;
    cin >> A >> B >> H >> M;
    
    long double C,rad;
    rad=M_PI/180*(30*H+M/2-6*M);
    C=sqrt(A*A+B*B-2*A*B*cos(rad));
    
    cout << fixed << setprecision(10);
    cout << C << endl;
    
}


Measured memory_bytes: 4168
#include <iostream>

using namespace std;

int main()
{
	int K, X, start;
	cin >> K >> X;
	start = X - K + 1;
	for (int count = 0; count < 2 * K - 1; count++)
	{
		cout << start + count;
		if (count != 2 * K - 2)
		{
			cout << " ";
		}
	}
	cout << endl;
}

Measured memory_bytes: 256
N = int(input())

d = dict()
m = 0
for i in range(N):
    s = input()
    if s in d:
        d[s] += 1
    else:
        d[s] = 1
    if d[s] >= m:
        m = d[s]

for k, v in sorted(d.items()):
	if v == m:
		print(k)


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

int main(){
    int n, d;
    cin >> n >> d;
    int check = 2 * d + 1;
    int div = n / check;
    if(n % check == 0){
        div = div;
    }else{
        div += 1;
    }
    cout << div << endl;
}

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

int main() {
    ll h, w;
    cin >> h >> w;
    if (h == 1 || w == 1) {
        cout << 1 << endl;
        return 0;
    }
    ll ans = ((h + 1) / 2) * ((w + 1) / 2);
    ans += (h / 2) * (w / 2);
    cout << ans << endl;
}

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

int main() {
	int a[4];
	while(1){
		for(int i=0;i<5;i++){
			int tmp,TMP; cin >> tmp >> TMP;
			if(!tmp && !TMP) return 0;
			a[i]=tmp+TMP;
		}
		int n=0,tmp=a[0];
		for(int i=1;i<5;i++){
			if(a[i]>tmp) tmp=a[i],n=i;
		}
		char ch='A'; ch+=n;
		cout << ch << ' ' << tmp << '\n' ;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <set>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define ALL(x) (x).begin(),(x).end()
int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

ll B[100007],A;

int main(){
    ll N,T=1;cin>>N;
    rep(i,N){
        cin >> A;
        B[A]++;
    }
    if(N%2==0){
        rep(i,N/2){
            if(B[i*2+1]!=2){
                cout << 0 << endl;
                return 0;
            }
            T*=2;
            T%=MOD;
        }
    }
    else{
        rep(i,N/2+1){
            if((i==0&&B[i]!=1)||(i>0&&B[2*i]!=2)){
                cout << 0 <<  endl;
                return 0;
            }
            if(i>0){
                T*=2;
                T%=MOD;
            }
        }
    }
    cout << T  << endl;
}

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

struct Bitset{
	using ull = unsigned long long;
	vector<ull> b;
	int n;
	int sz;
	Bitset(int x){
		n = x;
		b.resize((n+63)/64,0);
		sz = b.size();
	}
	
	int get(int x){
		return (b[x>>6]>>(x&63))&1;
	}
	
	void set(int x,int y){
		b[x>>6] |= 1ULL<<(x&63);
		if(!y)b[x>>6] ^= 1ULL<<(x&63);
	}
	
	Bitset &operator&=(const Bitset &another){
		rep(i,b.size()){
			b[i] &= another.b[i];
		}
		return (*this);
	}
	
	Bitset operator&(const Bitset &another)const{
		return (Bitset(*this)&=another);
	}
	
	Bitset &operator|=(const Bitset &another){
		rep(i,b.size()){
			b[i] |= another.b[i];
		}
		return (*this);
	}
	
	Bitset operator|(const Bitset &another)const{
		return (Bitset(*this)|=another);
	}
	
	Bitset &operator^=(const Bitset &another){
		rep(i,b.size()){
			b[i] ^= another.b[i];
		}
		return (*this);
	}
	
	Bitset operator^(const Bitset &another)const{
		return (Bitset(*this)^=another);
	}
	
	Bitset &operator>>=(int x){
		if(x&63){
			rep(i,b.size()-1){
				b[i] >>= (x&63);
				b[i] ^= (b[i+1]<<(64-(x&63)));
			}
			b.back() >>= (x&63);
		}
		
		x>>=6;
		rep(i,b.size()){
			if(i+x<b.size())b[i] = b[i+x];
			else b[i]=0;
		}
		return (*this);
	}
	
	Bitset operator>>(int x)const{
		return (Bitset(*this)>>=x);
	}
	
	Bitset &operator<<=(int x){
		if(x&63){
			int y = x&63;
			int z = 64-y;
			for(int i=sz-1;i>=1;i--){
				b[i] <<= y;
				b[i] ^= b[i-1]>>z;
			}
			b[0] <<= x&63;
		}
		
		x>>=6;
		for(int i=sz-1;i>=x;i--){
			b[i] = b[i-x];
		}
		rep(i,x)b[i] = 0;
		return (*this);
	}
	
	Bitset operator<<(int x)const{
		return (Bitset(*this)<<=x);
	}
	
};

int main(){
	
	int N;
	cin>>N;
	
	vector<int> A(N);
	int S = 0;
	
	for(int i=0;i<N;i++){
		cin>>A[i];
		S += A[i];
	}
	
	
	Bitset B(4000001);
	B.set(0,1);
	
	for(int i=0;i<N;i++){
		B |= (B<<A[i]);
	}
	
	int k = (S+1)/2;
	
	for(int i=k;true;k++){
		if(B.get(k)){
			cout<<k<<endl;
			return 0;
		}
	}
 
	
	return 0;
}
 


Measured memory_bytes: 4844
#include<stdio.h>

void shfl(int *a,int n,int r){
  int p,c;
  int nxt[n];
  if(r!=0){
    scanf("%d %d",&p,&c);
    int i=0;
    while(i<c){
      nxt[i]=a[p-1+i];
      i++;
    }
    i=0;
    while(i<p-1){
      nxt[c+i]=a[i];
      i++;
    }
    for(i=p+c-1;i<n;i++){
      nxt[i]=a[i];
    }
    shfl(nxt,n,r-1);
  }
  else{
    printf("%d\n",a[0]);
  }
}

void doit(int n,int r){
  int a[n];
  int i;
  for(i=0;i<n;i++){
    a[n-1-i]=i+1;
  }
  shfl(a,n,r);
}

int main(){
  int n,r;
  scanf("%d %d",&n,&r);
  while(n!=0){
    doit(n,r);
    scanf("%d %d",&n,&r);
  }
  return 0;
}

Measured memory_bytes: 608
#pragma GCC optimize("O2")
#pragma GCC target("avx2")
#include <iostream>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;
void solve() {
  unsigned long long N, D, x, y, ans = 0;
  cin >> N >> D;
  D *= D;
  rep(i, 0, N) {
    cin >> x >> y;
    ans += (D >= x * x + y * y);
  }
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
}

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

public class Main {


    public static void main(String[] args) {
        try (CustomReader in = new CustomReader()) {
            new Main().execute(in);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


    public void execute(CustomReader in) throws IOException {
        final int N = Integer.parseInt(in.readLine());
        int[] H = in.readLineAsIntArray();
        int cnt = 0;
        int border = 0;
        for (int i = 0; i < N; i++) {
            if (H[i] >= border) {
                cnt++;
                border = H[i];
            }
        }
        System.out.println(cnt);

    }

    static class CustomReader extends BufferedReader {

        //private static final int DEFAULT_BUF_SIZE = 2048;
        private static final int DEFAULT_BUF_SIZE = 4096;
        // private static final int DEFAULT_BUF_SIZE = 8192;
        //private static final int DEFAULT_BUF_SIZE = 16384;
        // private static final int DEFAULT_BUF_SIZE = 1048576;

        public CustomReader() throws IOException {
            super(new InputStreamReader(System.in), DEFAULT_BUF_SIZE);
        }

        public int[] readLineAsIntArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            int[] intArray = new int[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                intArray[i] = Integer.parseInt(strArray[i]);
            }
            return intArray;
        }

        public long[] readLineAsLongArray() throws IOException {
            String[] strArray = this.readLine().split(" ");
            long[] longArray = new long[strArray.length];
            for (int i = 0, n = strArray.length; i < n; i++) {
                longArray[i] = Long.parseLong(strArray[i]);
            }
            return longArray;
        }


        public int[][] readAsIntMatrix(int rows, int columns) throws IOException {
            int[][] matrix = new int[rows][columns];
            for (int i = 0; i < rows; i++) {
                String[] r = this.readLine().split(" ");
                for (int j = 0; j < columns; j++) {
                    matrix[i][j] = Integer.parseInt(r[j]);
                }
            }
            return matrix;
        }
    }

}

Measured memory_bytes: 22612
s = input()

right, left = [], []
r,l = 0,0
for i in range(len(s)):
    if s[i] == 'R':
        r += 1
        right.append(0)
    else:
        right.append(r)
        r = 0
    if s[-i-1] == 'L':
        l += 1
        left.append(0)
    else:
        left.append(l)
        l = 0
left = left[::-1]

ans = [0] * len(s)
for i in range(len(s)):
    if right[i]:
        ans[i] += right[i] // 2
        ans[i-1] += right[i] // 2 + right[i] % 2
    if left[i]:
        ans[i] += left[i] // 2
        ans[i+1] += left[i] // 2 + left[i] % 2
print(*ans)
       

Measured memory_bytes: 8000
#include<iostream>
#include<string>
#include<array>
#include<algorithm>
#include<deque>
#include<vector>

int main(void) {
	using namespace std;
	int D;
	cin >> D;
	switch (D)
	{
	case 25:
		cout << "Christmas" << endl;
		break;
	case 24:
		cout << "Christmas Eve" << endl;
		break;
	case 23:
		cout << "Christmas Eve Eve" << endl;
		break;
	case 22:
		cout << "Christmas Eve Eve Eve" << endl;
		break;
	default:
		break;
	}
}

Measured memory_bytes: 256
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(m)]
l = [0 for i in range(n)]
for i in range(m):
    l[AB[i][0]-1]+=1
    l[AB[i][1]-1]+=1
for i in range(n):
    print(l[i])

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

int main(){
  int n,k; cin >>n >>k;
  double prototal = 0;
  for(int i = 1; i<=n; i++){
    double pro = 1.0/n;
    int sum = i;
    while(sum<k){
      pro /= 2;
      sum *= 2;
    }
    prototal += pro;
  }
  cout << fixed << setprecision(12) << prototal << endl;
  return 0;
}

Measured memory_bytes: 3788
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
const int mod = 1000000007;
const ll INF = pow(10, 18);

int main(){
  int a, b, q;
  cin >> a >> b >> q;
  vector<ll> s(a);
  vector<ll> t(b);
  rep(i, a) cin >> s[i];
  rep(i, b) cin >> t[i];
  s.push_back(INF); s.push_back(-INF);
  t.push_back(INF); t.push_back(-INF);
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  vector<ll> res;
  rep(i, q) {
    ll x;
    cin >> x;
    ll ans = INF;
    rep(j, 2) {
      int first;
      if(j % 2) {
        first = lower_bound(s.begin(), s.end(), x) - s.begin();
      } else {
        first = upper_bound(s.begin(), s.end(), x) - s.begin() - 1;
      }
      rep(k, 2) {
        int second;
        if(k % 2) {
          second = lower_bound(t.begin(), t.end(), s[first]) - t.begin();
        } else {
          second = upper_bound(t.begin(), t.end(), s[first]) - t.begin() - 1;
        }
        ans = min(ans, abs(x - s[first]) + abs(s[first] - t[second]));
      }
    }
    
    rep(j, 2) {
      int first;
      ll tmp = 0;
      if(j % 2) {
        first = lower_bound(t.begin(), t.end(), x) - t.begin();
      } else {
        first = upper_bound(t.begin(), t.end(), x) - t.begin() - 1;
      }
      rep(k, 2) {
        int second;
        if(k % 2) {
          second = lower_bound(s.begin(), s.end(), t[first]) - s.begin();
        } else {
          second = upper_bound(s.begin(), s.end(), t[first]) - s.begin() - 1;
        }
        ans = min(ans, abs(x - t[first]) + abs(t[first] - s[second]));
      }
    }
    res.push_back(ans);
  }
  rep(i, q) cout << res[i] << endl;
}

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

int main() {
  int a;
  cin >> a;
  
  for (int i = 0;i < 9;i++) {
    for (int j = 0;j < 9;j++) {
      if ((i + 1) * (j + 1) == a) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<queue>
#define _USE_MATH_DEFINES
#include<math.h>
#include<cmath>
#include<ctime>
#include<map>
#define R(i, n) for(int i = 0;i < n;i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define SL(a) scanf("%lld", &a)
#define SL2(a, b) scanf("%lld%lld", &a, &b)
#define SL3(a, b, c) scanf("%lld%lld%lld", &a, &b, &c)
#define SA(i, n, a) R(i, n) scanf("%d", a + i)
#define SAL(i, n, a) R(i, n) scanf("%lld", a + i)
#define SC(a) scanf("%c", &a);
#define P(a) printf("%d", a)
#define PL(a) printf("%lld", a)
using namespace std;
using ll = long long;
using PR = pair<int, int>;
const ll MOD = 1e+9 + 7;
const int INF = 1e+9;

string S;

int main() {
	cin >> S;
	if (S == "ABC") printf("ARC");
	else printf("ABC");
}



Measured memory_bytes: 3688
#include <stdio.h>
#include <string.h>

int souoc(int n) {
	int i;
	int sum = 0;

	for (i = 1; i <= n; i++) {
		if (n%i == 0) {
			sum++;
		}
	}

	return sum;
}

int main() {
	int n;
	int sum =0;
	int i;

	scanf("%d", &n);

	if (n >= 105) {
		for (i = 105; i <= n; i+=2) {
			if (souoc(i) == 8) {
				sum++;
			}
		}

		printf("%d", sum);
	}
	else {
		printf("0");
	}


	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = INT_MAX;
bool mywish(const pii &a,const pii &b)
  {
    return a.first > b.first;
  }
int power(int base,int n,int m)
 {
  if(n == 0)
     return 1;
  if(n&1)
     {
      int y = power(base,n-1,m);
      return (y*base)%m;
     }
  else
     {
      int y = power(base,n/2,m);
      return (y*y)%m;
     }
 }

void solve()
  {
   int n,m;
   cin>>n>>m;
   vector<int> v(n);
   int lcm = 1;
   int p2 = -1;
   loop(i,0,n)
    { 
     cin>>v[i];
     int x = v[i];
     lcm = lcm*v[i]/__gcd(v[i],lcm);
     int temp = 0;
     while(x%2==0)
       {
        x/=2;
        temp++;
       }
     if(p2 == -1)
       p2 = temp;
     else if(p2 != temp)
       p2 = -2;
    }
  if(p2 == -2)
     {
      cout<<0;
      return;
     }
  int mx = 2*m/lcm;
  int count = ceil(1.0*mx/2);
  cerr<<lcm<<END;
  cout<<count;
  }
signed main()
 {
  
     solve();
  //cerr<<END<<1.0*clock();
  return 0;
}    


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
int main(void){
    // Your code here!
    ll n,m;
    cin>>n>>m;
    vector<vector<ll>> s(m);
    vector<ll> k(m),p(m);
    rep(0,i,m){
        cin>>k[i];
        rep(0,j,k[i]){
            ll s0;
            cin>>s0;
            s[i].push_back(s0);
        }
    }
    rep(0,i,m){
        cin>>p[i];
    }
    ll ans=0;
    rep(0,bit,1<<n){
        vector<ll> ns;
        rep(0,i,n){
            if(bit & (1<<i)){
                ns.push_back(i);
            }
        }
        ll T=true;
        /*rep(0,i,ns.size()){
            cout<<ns[i]<<" ";
        }*/
        //cout<<endl;
        rep(0,i,m){
            ll np=0;
            rep(0,j,k[i]){
                rep(0,l,ns.size()){
                    if(s[i][j]-1==ns[l]){
                        ++np;
                        //cout<<s[i][j]<<" ";
                        //cout<<"true"<<endl;
                    }
                    //cout<<endl;
                }
            }
            if(np%2 !=p[i] && T)T=false;
        }
        if(T){
            ++ans;
            /*rep(0,i,ns.size()){
                cout<<ns[i]<<" ";
            }
            cout<<endl;*/
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int input;
	scanf("%d", &input);
	if (input < 105)
		printf("0");
	else if (input < 135)
		printf("1");
	else if (input < 165)
		printf("2");
	else if (input < 189)
		printf("3");
	else if (input < 195)
		printf("4");
	else
		printf("5");
	return 0;
}

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

Query = []
for _ in range(M):
    Query.append(list(map(int, input().split())))


Query.sort(key = lambda x : x[1])

count = 1
last = Query[0][1]
for i in range(1, M):
    if Query[i][0] >= last:
        count += 1
        last = Query[i][1]
print(count)


Measured memory_bytes: 29076
#include <bits/stdc++.h>
#define ll          long long int
#define uu          first
#define vv          second
#define pii         pair<int,int>
#define pll         pair<ll,ll>
#define INF         1e9
#define fastRead    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;

const int MAX = 1e6 + 6;
const int MAXL = 1e5 + 5;
const int TILL = (1<<9);

ll val[MAX], wt[MAX];
ll dp[TILL + 5][MAXL];

vector<int>sml[MAX],  big[MAX];

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

    for(int i = 1 ; i <=n ; i++ ) cin>>val[i]>>wt[i];
    
    for(int i = 1 ; i <=n ; i++ ) {
        
        int tmp = i;
        while(tmp> TILL) {
            big[i].push_back(tmp);
            tmp/=2;
        }
        while(tmp) {
            sml[i].push_back(tmp);
            tmp/=2;
        }
    }
    
    
    for(int i =1 ; i <= min(n,TILL) ; i++) {

        for(int j = 0 ; j < MAXL ; j++ ) {
            
            dp[i][j] = dp[i/2][j];
            
            if(wt[i] <= j) dp[i][j] = max(dp[i][j], dp[i/2][j - wt[i]] + val[i] );
        }
    }
    
    int q;
    cin>>q;
    while(q--) {
        int v, l;
        cin>>v>>l;
        if(v <=TILL) {
            cout<<dp[v][l]<<'\n';
            continue;
        }
            
        
        int nn = big[v].size();
        ll ans = 0;
        
        for(int mask = 0 ; mask < (1<<nn ) ; mask++ )  {
        
            ll prof = 0;
            ll totW = 0;
            for(int j =0 ; j < nn ; j++ ) {
                if(mask & (1<<j)) {
                    prof += val[big[v][j]];
                    totW += wt[big[v][j]];
                }
            }
            if(totW > l) continue;
            int baki = l - totW;
            
            ans = max(ans, prof + dp[ sml[v][0] ][baki]);
        }
        cout<<ans<<'\n';
    }

    return 0;
}


Measured memory_bytes: 491344
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
// #define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];

int get(int num){
  vi big,small;
  int a,b;
  a = b = 0;

  while(num > 0){
    big.pb(num % 10);
    num /= 10;
  }
  rep(i,big.sz,m)big.pb(0);
  small = big;
  sort(all(big));
  sort(all(small),greater<int>());

  rep(i,0,big.sz){
    a += big[i] * pow(10,i);
    b += small[i] * pow(10,i);
  }

  return a-b;
}

void solve(){
  vi vec;
  int now = 0;
  int ans = -1;
  vec.pb(n);
  while(1){
    now = get(vec[vec.sz-1]);
    rep(i,0,vec.sz){
      if(vec[i] == now){
        cout << i << " " << now << " " <<  vec.sz-i << endl;
        return;
      }
    }
    vec.pb(now);
  }
}

int main(){
  while(cin >> n >> m,(n+m) != 0){
    solve();
  }
  return 0;
}


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

#define _USE_MATH_DEFINES
#define reb(i,b,n)         for(int i=(int)(b); i<(int)(n); i++)
#define rep(i,n)           reb(i,0,n)
#define each(it,v)         for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define reach(it,v)        for(__typeof((v).rbegin()) it=(v).rbegin();it!=(v).rend();it++)
#define vsort(x)           sort((x).begin(), (x).end())
#define rvsort(x)          sort((x).rbegin(), (x).rend())
#define mp(a, b)           make_pair(a, b)
#define fi                 first
#define se                 second
#define pb                 push_back
#define dbg(x)             cerr<<__LINE__<<": "<<#x<<" = ["<<(x)<<"]"<<endl;
#define dbgArr(table, n)   rep(i,n){cout<<table[i]<<' ';}cout<<'\n';
#define dbg2Arr(table,W,H) rep(y,H){rep(x,W)cout<<table[y][x]<<' ';cout<<'\n';}

using namespace std; using std::stringstream;

typedef long long       ll; typedef unsigned long long ull; typedef long double     ld;
typedef pair <int, int> P;  typedef pair <int, P>      PP;
typedef vector<int>     vi; typedef vector<vi>         vvi; typedef vector<ll>      vl;
typedef vector<P >      vP; typedef vector<char>       vc;  typedef vector<string>  vs;

static const int    INF  = 0x3f3f3f3f;
static const ll     INFL = 0x3f3f3f3f3f3f3f3fLL;
static const double EPS  = 1e-9;
static const ll     MOD  = 1000000007LL;

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

int main(int argc, char *argv[])
{
    int N;
    cin >> N;
    vi A(N);
    rep(i, N) {
        cin >> A[i];
    }

    vsort(A);

    const int A_MAX = 1000001;

    vector<bool> v(A_MAX, true);
    int pre = 0;
    for (auto a_i : A) {
        const int use_pre = pre;
        pre = a_i;
        if (use_pre == a_i) {
            v[a_i] = false;
            continue;
        }

        for (int i = a_i*2; i < A_MAX; i += a_i) v[i] = false;
    }

    int ans = 0;
    for (auto a_i : A) {
        if (v[a_i]) ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4312
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dat[ohara];
vector<P> ans;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>k;
    cnt=1;
    rrep(i,1,105){
        dat[i]=cnt;
        cnt+=(i+1);
    }
    ll ma=dat[n-2];
    if(ma<k)Cout(-1);
    else{
        rrep(i,2,n+1){
            ans.push_back({1,i});
        }
        ll add=ma-k;
        rrep(i,2,n+1){
            rrep(j,i+1,n+1){
                if(add==0)break;
                ans.push_back({i,j});
                add--;
            }
            if(add==0)break;
        }
        Cout(Size(ans));
        rep(i,Size(ans)){
            cout<<ans[i].fi<<" "<<ans[i].se<<"\n";
        }
    }
    return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>

#define INF (1ll<<60)
#define MOD 1000000007
#define BOUND 27182818284

typedef long long ll;
typedef long long int lli;

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

template<class T>bool umax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool umin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using namespace std;

// gcd
int gcd(int a, int b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}
// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);

    return result;
}

// sort big to small
// sort(A,A+N, greater<int>());

// v.front() = -BOUND;
// v.back() = BOUND;

// Iterator
// v.begin
// v.end

int main() {
    int A,B,C,D,E,F;
    double ans_noudo=-1;
    int ans_sum=0,ans_sugar=0;
    vector<int>water,sugar;
    cin >> A >> B >> C >> D >> E >> F;

    for(int i=0; 100*A*i<=F; i++){
        for(int j=0; 100*B*j<=F; j++ ){
            if(100*A*i+100*B*j<=F )
                water.push_back(100*A*i+100*B*j);
        }
    }
    for(int i=0; C*i<=F; i++){
        for(int j=0; D*j<=F; j++ ){
            if(C*i+D*j<=F )
                sugar.push_back(C*i+D*j);
        }
    }

    for(int i=0 ; i<water.size() ; i++){
        for (int j = 0; j < sugar.size(); j++) {

            double t = (double) ( 100 * sugar.at(j) ) / ( water.at(i) + sugar.at(j) );
            if( water.at(i)+sugar.at(j) <= F && t>ans_noudo && water.at(i)!=0
            && sugar.at(j) <= water.at(i) * E / 100 )
            {
                ans_noudo = t;
                ans_sum = water.at(i) + sugar.at(j);
                ans_sugar = sugar.at(j);
            }
        }
    }

    cout << ans_sum << " " << ans_sugar << endl;
    return 0;
}



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

int main()
{
    int n, k, q, a = 0;
    cin >> n >> k >> q;
    vector<int> t(n,0), b(n,k);
    for(int i = 0;i < q;i++){
        cin >> a;
        t[a - 1]++;
    }

    for(int i = 0;i < n;i++){
        if(k - q + t[i] > 0){
            cout << "Yes\n";
        }
        else{
            cout << "No\n";
        }
    }


    return 0;
}

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


int main() {

  long double a,v,b,w,t;
  cin>>a>>v>>b>>w>>t;


  if(w>=v)
    cout<<"NO"<<endl;
  else{
    if(abs(a-b)/(v-w)<=t)
      cout<<"YES"<<endl;
    else
      cout<<"NO"<<endl;
  }

    return 0;
}


Measured memory_bytes: 3720
//コンパイラ最適化用
#pragma GCC optimize("O3")
//インクルード(アルファベット順)
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) ll(x.size()) //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
#define Umap unordered_map
#define Uset unordered_set

signed main(){
  int N, cnt = 0;
  cin >> N;
  long L[N];
  for(int i = 0; i < N; i++)  cin >> L[i]; 
  for(int i = 0; i < N - 2; i++){
    for(int j = i+1; j < N -1; j++){
      if(L[i] != L[j]){
        for(int k = j+1; k < N; k++){
          if((L[i] != L[k])&&(L[j] != L[k])){
            if(((abs(L[i] - L[j]) < L[k])) && (L[k] < L[i] + L[j]))
              cnt ++;
          }
        }
      }
    }
  }
  cout << cnt;
}



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

using namespace std;
typedef long long ll;

#define INF (long long)(1e9+7)
#define REP(i,n) for(ll i = 0; i < n; i++)
#define REP1(i,n) for(ll i = 1; i <= n; i++)

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

set<ll> s;

int main(void)
{
  REP(i, 3) {
    ll t;
    cin >> t;
    s.insert(t);
  }
  cout << s.size() << endl;
  
}


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

//Made with <3 by MinumCoklatPanas
typedef long long ll;
const int INF = 1e9;
const ll INFF = 1e18;
const int MAXN = 510;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
const double INFD = 1E9;
const double EPS = 1e-9;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,d;
    cin >> n >> d;
    d *= d;
    int ans = 0;
    for (int i = 1 ; i <= n ; i++)
    {
        ll x,y;
        cin >> x >> y;
        ll k = x * x + y * y;
        ans += (k <= d);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"

#define REP(i, a, b) for (int i = (a); i <= (b); ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define FORV(a, A) for (auto &a : A)

using namespace std;

using ll = long long;

void Main() {
  string S;
  cin >> S;
  for (int i = 0; i < S.length(); i++) {
    if (i % 2) {
      if (S[i] == 'R') {
        cout << "No" << endl;
        return;
      }
    } else {
      if (S[i] == 'L') {
        cout << "No" << endl;
        return;
      }
    }
  }
  cout << "Yes" << endl;
  return;
}

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


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

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
using namespace std; //std::の省略のため
using ll = long long;

ll MOD = 1000000007;

int main()
{
    ll d, t, s;
    cin >> d >> t >> s;
    double time = (double)d / (double)s;
    if (time > t)
    {

        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }
}


Measured memory_bytes: 3620
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import bisect_right
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
MOD = 10**9+7
ans = pow(10,N,MOD)
ans += pow(8,N,MOD)
ans -= pow(9,N,MOD)
ans -= pow(9,N,MOD)
ans %= MOD
print(ans)
            








Measured memory_bytes: 10532
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;

int main()
{
	const string event[] = { "HIT", "OUT", "HOMERUN" };
//	cut here before submit 
//	freopen("testcase.baseball2", "r", stdin);
	string str = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;
	queue <char> stat;

	int score = 0;
	int out = 0;
	int count = 0;
	int i;
	while (getline (cin, str ) ){
		
		for (i = 0; i < sizeof(event)/sizeof(event[0]); ++i){
			if (str == event[i]){
				switch(i){
					case 0:
						stat.push ('R');
						break;
					case 1:
						++out;
						break;
					case 2:
						int runner = 0;
						while (!stat.empty() ){
							char c = stat.front();
							if (c == 'R'){
								++runner;
							} // end if
							stat.pop();
						} // end while
						score += runner + 1;
						break;
				} // end switch
				break;
			} // end if
		} // end for
		if (out == 3){
			cout << score << endl;
			score = 0;
			out = 0;
			while (!stat.empty() ){
				stat.pop();
			} // end while
			++count;
		} // end if
		if (stat.size() == 4){
			if (stat.front() == 'R'){
				++score;
			} // end if
			stat.pop();
		} // end if
		if (count == n){
			break;
		} // end if
	} // end loop

//	cout << res << endl;	
		
	return 0;
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		List<String> s = Arrays.asList(scanner.next().split(""));

		if(s.size() == 2 && (s.get(0).equals(s.get(1))) ) {
			System.out.println("1 2");
			return;
		}

		for(int i = 0 ; i < s.size() - 2 ; i++) {
			List<String> t = s.subList(i, i + 3);
			if ((t.stream().filter(u -> u.equals(t.get(0))).count() > 1) ||
					(t.stream().filter(u -> u.equals(t.get(1))).count() > 1))  {
				System.out.println((i + 1) + " " + (i + 3));
				return;
			}
		}

		System.out.println("-1 -1");

		scanner.close();
	}
}


Measured memory_bytes: 65416
n,m = gets.split.map(&:to_i)
a = gets.split.map{|i|i.to_i-1}
sums = Array.new(2*m+2,0)
for i in 1..n-1
    r = a[i]
    r += m if a[i-1] > a[i]
    sums[a[i-1]+2] += 1
    sums[r+1] -= r-a[i-1]
    sums[r+2] += r-a[i-1]-1
end
for i in 0..2*m
    sums[i+1] += sums[i]
end
for i in 0..2*m
    sums[i+1] += sums[i]
end
b = Array.new(m){|i|sums[i]+sums[i+m]}
mx = 0
m.times do |i|
    mx = i if b[mx] < b[i]
end
ans = 0
for i in 1..n-1
    x = a[i]-a[i-1]
    y = a[i]-mx
    x += m if x < 0
    y += m if y < 0
    ans += (x < y+1 ? x : y+1)
end
puts ans

Measured memory_bytes: 10388
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1e9+7,INF=mod*mod*3;//M_PI
#define rep(i,N) for(ll i=0; i<(N); i++)
#define rep1(i,N) for(ll i=1; i<(N); i++)
#define pb push_back

ll A;
double B;

int main(){

cin.tie(0);
ios::sync_with_stdio(false);

cin>>A>>B;
ll C=100*B+0.5; 
ll D=A*C;
cout<<D/100<<endl;


}
    


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

int frogjump(int height[], int n)
{
    int dp_2 = 0;
    int dp_1 = abs(height[1] - height[2]);
    int anstillnow = INT_MAX;
    for (int i = 3; i <= n; i++)
    {
        anstillnow = min(dp_2 + abs(height[i - 2] - height[i]), dp_1 + abs(height[i - 1] - height[i]));
        dp_2 = dp_1;
        dp_1 = anstillnow;
    }
    return anstillnow;
}

int main()
{
    //freopen("inp.txt","r",stdin);
    int n;
    cin >> n;
    int height[n + 1];
    for (int i = 1; i <= n; i++)
    {
        cin >> height[i];
    }
    if(n<3)
    {
        if(n==2)
        cout<<abs(height[2]-height[1]);
        if(n==1)
        {
            cout<<0;
        }
        
    }else
    {
        cout << frogjump(height, n);
    }
    
    return 0;
}

Measured memory_bytes: 3988
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll; const ll MM = 1000000000;ll mod = MM + 7;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;


bool IsPrime(ll num){
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;
  double sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2){
    if(num % i == 0) return false;
  }
  return true;
}

int main() {
  string s, t; cin >> s >> t;
  int a, b; cin >> a >> b;
  string u; cin >> u;
  if(s == u) a--;
  else b--;
  cout << a << ' ' << b << endl;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!

c11, c12, c13 = list(input())
c21, c22, c23 = list(input())

# print(c11)
# print(c12)
# print(c13)

# print(c21)
# print(c22)
# print(c23)

if c11 == c23 and c12 == c22 and c13 == c21 and c21 == c13 and c22 == c12 and c23 == c11:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define s second
#define f first
#define ll long long 
bool comp(pair<int,int> &a , pair<int,int>&b)
{
    return a.s>=b.s;
}
ll power(ll a,ll b)
{
    if(b==0)
        return 1;
    ll res = power(a,b/2);
    res = res*res;
    if(b%2==0)
        return res;
    else return res*a;
}
double exp(double a, double b){
    double t(1);
    for(int i = 0;i<b;++i)
        t *= a;
    return t;
}
double n_root_(double num, double n_){
    double x;
    double A(num);
    double dx;
    double eps(10e-6);
    double n(n_);
    x = A * 0.5;
    dx = (A/exp(x,n-1)-x)/n;
    while(dx >= eps || dx <= -eps){
        x = x + dx;
        dx = (A/exp(x,n-1)-x)/n;
    }
   return x;
}
int main()
{
	ll x;
    cin>>x;
    for(ll i=-1000;i<=1000;i++)
    {
        ll a=power(i,5);
        ll b=a-x;
        ll root = n_root_(b,5);
        if(power(root,5)==b)
        {
            cout<<i<<" "<<root<<endl;
            break;
        }
    }
}

Measured memory_bytes: 3592
using System;
using System.Linq;

namespace M_solutions2020
{
    class Program
    {
        static void Main(string[] args)
        {
            b();
        }

        public static void b()
        {
            int[] abc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int k = int.Parse(Console.ReadLine());
            for(int i = 0; i < k; i++)
            {
                if (abc[0] >= abc[1])
                    abc[1] *= 2;
                else if (abc[1] >= abc[2])
                    abc[2] *= 2;
            }
            if(abc[0] < abc[1] && abc[1] < abc[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 28268
from itertools import permutations

N = int(input())
P = tuple(int(x) for x in input().split())
Q = tuple(int(x) for x in input().split())

ps = permutations(range(1, N + 1))

try:
    x, y = [i for i, t in enumerate(ps) if t == P or t == Q]
except ValueError:
    print(0)
else:
    print(abs(x - y))


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
    int a, b, k; cin >> a >> b >> k;
    vector<int> x;
    rep(i, k) {
        if(a+i > b-i) break;
        x.push_back(a+i);
        x.push_back(b-i);
    }
    sort(x.begin(),x.end());
    rep(i, x.size()) {
        if(i!=0&&x[i-1]==x[i]) continue;
        cout << x[i] << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	string ans;
	for (char c : s) {
		if (c == '1') {
			ans+='1';
		}
		else if (c == '0') {
			ans+='0';
		}
		else {
			if (ans.begin() == ans.end()) {
				continue;
			}
			else {
				ans.erase(ans.end() - 1);
			}
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    A = list(map(int,input().split()))
    insertionSort(A, N)

def insertionSort(A, N):
    print(*A)
    for i in range(1,N):
        v = A[i]
        j = i - 1
        while j>= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A)

if __name__ == '__main__':
    main()


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

using namespace std;

const int INF = 1e3;

char a[INF][INF];

int main() {
	int n, m; cin >> n >> m;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			cin >> a[i][j];
		}
	}
	int sum = 0;
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			sum = 0;
			if(a[i][j] == '#'){
				continue;
			}
			if(a[i][j+1] == '#') sum++;
			if(a[i][j-1] == '#') sum++;
			if(a[i+1][j] == '#') sum++;
			if(a[i-1][j] == '#') sum++;
			if(a[i-1][j-1] == '#') sum++;
			if(a[i-1][j+1] == '#') sum++;
			if(a[i+1][j-1] == '#') sum++;
			if(a[i+1][j+1] == '#') sum++;
			a[i][j] = char(sum+48);
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < m;j++){
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
(let* ((n (read))
       (m (read))
       (h (coerce (cons 0 (loop repeat n collect (read))) 'vector))
       (good-obs (make-array (+ n 1) :initial-element t)))
  (loop repeat m
        for a = (read)
        for b = (read)
        do (cond
             ((= (aref h a) (aref h b)) (progn
                                          (setf (aref good-obs a) nil)
                                          (setf (aref good-obs b) nil)))
             ((< (aref h a) (aref h b)) (setf (aref good-obs a) nil))
             (t (setf (aref good-obs b) nil))))
  (format t "~a~%" (loop for i from 1 to n
                         counting (aref good-obs i))))


Measured memory_bytes: 80448
while line = gets.split.map(&:to_i) and line !=[0,0]
    counter =0
    ans = []
    line[0].times { |n|
        ans << n + 1
    }

    ans.combination(3).to_a.each do |n| 
        counter += 1 if n.inject(:+) == line[1]
    end
    puts counter
end


Measured memory_bytes: 27100