akhauriyash/Code-Regression huggingface dataset:
//Use valgrind once if the submission doesn't go through. It can detect uninitialized variables and see where they could be an issue.
#include <bits/stdc++.h>
#include<numeric>
using namespace std;
long long pow2(long long n)
{
	if(n==0)
	{
		return 1;
	}
	else if(n%2==1)
	{
		return (2*pow2(n-1))%1000000007;
	}
	else
	{
		long long temp=pow2(n/2);
		return (temp*temp)%1000000007;
	}
}
int main(){

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);

	int N;
	long long count=1;
	cin>>N;
	vector<long long> a(N), b(N);
	map<pair<long long,long long>,pair<long long,long long>> m;
	m.insert({{0LL,0LL},{0LL,0LL}});
	for(int i=0;i<N;i++)
	{
		cin>>a[i]>>b[i];
		long long GCD=gcd(a[i],b[i]);
		if(GCD==0) GCD=1;
		if(m.find({a[i]/GCD,b[i]/GCD})!=m.end())
		{
			++m[{a[i]/GCD,b[i]/GCD}].first;
		}
		else if(m.find({-a[i]/GCD,-b[i]/GCD})!=m.end())
		{
			++m[{-a[i]/GCD,-b[i]/GCD}].first;
		}
		else if(m.find({-b[i]/GCD,a[i]/GCD})!=m.end())
		{
			m[{-b[i]/GCD,a[i]/GCD}].second+=1;
		}
		else if(m.find({b[i]/GCD,-a[i]/GCD})!=m.end())
		{
			++m[{b[i]/GCD,-a[i]/GCD}].second;
		}
		else
		{
			m.insert({{a[i]/GCD,b[i]/GCD},{1,0}});
		}
	}
	//cout<<endl;
	for(auto i:m)
	{
		if(i.first.first==0&&i.first.second==0) continue;
		long long temp=count,t1=pow2(i.second.first),t2=pow2(i.second.second);
		count*=t1;
		count%=1000000007;
		temp*=t2-1;
		temp%=1000000007;
		count+=temp;
		count%=1000000007;
		//cout<<count<<endl;
	}
	count+=m[{0,0}].first;
	count%=1000000007;
	if(count!=0)
	cout<<count-1<<endl;
	else cout<<1000000006<<endl;
	return 0;
}

Measured memory_bytes: 21944
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(int i = (int)(b); i < (int)(e); ++i)
#define RFOR(i, b, e) for(int i = (int)(e-1); i >= 0; --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define PAIR pair<int,int>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;

using namespace std;

int main() {
	int n;
	cin >> n;
	cout << ((n < 1200) ? "ABC" :
		(n < 2800) ? "ARC" : "AGC") << endl;
}

Measured memory_bytes: 256
n,m = map(int,input().split())

ban = [False]* (n+1)

dp = [0]*(n+1)
dp[0] = 1

li = []
for mi in range(m):
    i = int(input())
    ban[i] = True

for i in range(n):
    if ban[i]:
        dp[i]=0
        continue
    if i+1 <n+1:
        dp[i+1] += dp[i]
    if i+2 <n+1:
        dp[i+2] += dp[i]
print(dp[n]%(10**9+7))

Measured memory_bytes: 463476
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int H, W, N;
	cin >> H >> W >> N;

	int h, w;
	cin >> h >> w;

	string S, T;
	cin >> S >> T;

	int left = 1, right = W;
	if (S[N - 1] == 'L')left++;
	if (S[N - 1] == 'R')right--;

	for(int i = N - 2; i >= 0; i--) {
		if (T[i] == 'L')right = min(right + 1, W);
		else if (T[i] == 'R')left = max(1LL, left - 1);

		if (S[i] == 'L')left++;
		else if (S[i] == 'R')right--;
		
		if (left > right) {
			cout << "NO" << endl;
			return 0;
		}
	}
	if (left > w || w > right) {
		cout << "NO" << endl;
		return 0;
	}
	left = 1, right = H;
	if (S[N - 1] == 'U')left++;
	if (S[N - 1] == 'D')right--;

	for (int i = N - 2; i >= 0; i--) {
		if (T[i] == 'U')right = min(right + 1, H);
		else if (T[i] == 'D')left = max(1LL, left - 1);

		if (S[i] == 'U')left++;
		else if (S[i] == 'D')right--;

		if (left > right) {
			cout << "NO" << endl;
			return 0;
		}
	}
	if (left > h || h > right) {
		cout << "NO" << endl;
		return 0;
	}

	cout << "YES" << endl;


	return 0;
}



Measured memory_bytes: 920
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class BGoldenApple {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N, D;
        cin >> N >> D;
        int res = N / (2 * D + 1);
        if (N % (2 * D + 1) != 0) res++;
        cout << res << endl;
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    BGoldenApple solver;
    solver.solve(in, out);
    return 0;
}


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

#define uni(x)      (x).resize(unique(ALL(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define PI          3.14159265358979323846
#define MP(x, y)    make_pair(x, y)
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ld          long double
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<int> bulb[12]; // bulb[i] holds switches
    for(int i = 1; i <= m; i++){
        int k;
        cin >> k;
        while(k--){
            int x;
            cin >> x;
            bulb[i].PB(x);
        }
    }
    vector<int> p(m + 1, 0);
    for(int i = 1; i <= m; i++){
        cin >> p[i];
    }
    int ans = 0;
    for(int i = 0; i < (1 << n); i++){
        map<int, int> ons;
        for(int j = 0; j < n; j++){
            if(i & (1 << j)){
                ons[j + 1] = 1;
            }
        }
        bool all_on = true;
        for(int j = 1; j <= m; j++){
            int sw = 0;
            for(auto &x : bulb[j]){
                sw += ons[x];
            }
            all_on &= (sw % 2 == p[j] % 2);
        }
        ans += (all_on == true);
    }
    cout << ans;
    return 0;
}
/*
    *** Most Impo.. -> check base case always
    1. Overflow Check (*, +)
    2. Index check (0 - based or 1 - based)
    3. Check for n = 1, 2, 3, 4....
    4. Corner Cases
*/

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

typedef long long int int64;
int64 p[1503];
int pn;
int n;
int main()
{
	scanf("%d",&n);
	int i = 2;
	while(pn < 1500) {
		for(int j = 2;j * j <= i;++j) if(i % j == 0) goto isp;
		p[pn++] = i;
		isp:
		++i;
	}
	for(int i = 0;i < n;++i) {
		for(int j = 0;j < n;++j) {
			int64 val;
			if(((i+j)&1) == 1) {
				val = p[(i+j-1)/2] * p[(i+j+1)/2] * p[(i-j-1)/2+2*n] * p[(i-j+1)/2+2*n] + 1;
			} else {
				val = p[(i+j)/2] * p[(i-j)/2+2*n];
			}
			printf("%lld ", val);
		}
		printf("\n");
	}
}


Measured memory_bytes: 3200
#include<stdio.h>
int main()
{
    int A,B,C,D,L,R;
    scanf("%d %d %d %d",&A,&B,&C,&D);
    L=A+B;
    R=C+D;
    if(L>R)
        {printf("Left\n");}
    if(L==R)
         {printf("Balanced\n");}
    if (L<R)
         {printf("Right\n");}
    return 0;
    }

Measured memory_bytes: 1660
#include <iostream>

using namespace std;

void judge(int *cards){
    int i,j;
    int index[4] = {0};
    
    for(i = 1; i < 14; i++){
        if(cards[i] == 0){
            continue;
        }
        
        if(cards[i] == 4){
            cout<<"four card"<<endl;
            return;
        }
        else if(cards[i] == 1){
            for(j = i+1; j < 15; j++){
                if(cards[j] != 1){
                    break;
                }
            }
            if(j-i == 5){
                cout<<"straight"<<endl;
                return;
            }
        }
        else if(cards[i] == 2){
            index[2]++;
        }
        else{
            index[3]++;
        }
    }
    
    if(index[2] == 2){
        cout<<"two pair"<<endl;
        return;
    }
    
    if(index[3] == 1){
        if(index[2] == 1){
            cout<<"full house"<<endl;
        }else{
            cout<<"three card"<<endl;
        }
    }else{
        if(index[2] == 1){
            cout<<"one pair"<<endl;
        }else{
            cout<<"null"<<endl;
        }
    }
    return;
}

int main(void){
    int cards[15] = {0};
    int num,i,j;
    char c;
    
   while(cin>>num){
       if(num == 1){
           cards[14]++;
       }
       cards[num]++;
       
       for(i = 0; i < 4;i++){
            cin>>c>>num;
            if(num == 1){
                cards[14]++;
            }
            cards[num]++; 
       }
       
       judge(cards);
       
       for(i = 0; i < 15;i++){
            cards[i] = 0;
       }

   }
   
   return 0;
}



Measured memory_bytes: 3080
#include <set>
#include <map>
#include <ctime>
#include <cmath>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define PII pair<LL,LL>
#define sqr(x) (x)*(x)
#define FOR(i,a,b) for (LL i=(a);i<=(b);++i)
#define ROF(i,b,a) for (LL i=(b);i>=(a);--i)
typedef long long LL;
inline LL read(){
	LL x=0,f=1; char ch=getchar();
	while (ch<'0'||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
	while (ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	return x*f;
}

const LL MAXN=300005,INF=10000000000000000LL;
LL n,m,a[MAXN];
int main(){
	m=read();
	if (m>INF) {
		n=50;
		FOR(i,1,n) a[i]=i-1;
		FOR(i,1,n) a[i]+=m/50;
		m%=50;
		ROF(i,50,51-m) a[i]++;
	}
	else {
		n=2;
		a[1]=m/2+1; a[2]=a[1]-1;
		if (m%2) {
			a[1]--;
			a[2]+=2;
		}
	}
	cout<<n<<endl;
	FOR(i,1,n) cout<<a[i]<<' ';
	cout<<endl;
	
	return 0;
}

/*
*/


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt();
			int[] a = in.nextIntArray(n);

			long ans = 0;
			int l = 0, r = 0;
			long num = 0;
			while (l < n) {
				if (r < n && num + a[r] == (num ^ a[r])) {
					num ^= a[r];
					r++;
				} else {
					ans += r - l;
					num ^= a[l];
					l++;
				}
			}

			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 43596
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

using System.Collections;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());

        Console.WriteLine(180 * (N - 2));
    }
}


Measured memory_bytes: 13140
H, W, K = map(int, input().split())
matrix = [input() for _ in range(H)]
ans = 0

for maskR in range(1 << H):
	for maskC in range(1 << W):
		black = 0
		for i in range(H):
			for j in range(W):
				if (maskR >> i) & 1 == 0 and (maskC >> j) & 1 == 0 and matrix[i][j] == "#":
					black += 1

		if black == K:
			ans += 1

print(ans)


Measured memory_bytes: 73816
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
const int MOD = 1e9+7;
#define PI 3.14159265359
typedef long long ll;
using namespace std;

ll dp1[100][4]; //小さい
ll dp2[100][4]; //ぴったり

int stoi(char c){
	return c - '0';
}

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

	if (s[0] == '0'){
		dp2[0][0] = 1;
	}else{ 
		dp1[0][0] = 1;
		dp1[0][1] = stoi(s[0]) - 1;
		dp2[0][1] = 1;
	}

	for (int i = 1; i < s.length(); i++){
		for (int j = 0; j <= k; j++){
			dp1[i][j] += dp1[i-1][j];
			if (s[i] == '0'){
				dp2[i][j] = dp2[i-1][j];
			}else{
				dp1[i][j] += dp2[i-1][j];
			}

			if (j == k) continue;
			dp1[i][j+1] += dp1[i-1][j]*9;
			if (s[i] != '0'){
				dp1[i][j+1] += dp2[i-1][j]*(stoi(s[i])-1);
				dp2[i][j+1] = dp2[i-1][j];
			}
		}
	}

	cout << dp1[s.length()-1][k] + dp2[s.length()-1][k] << endl;
	return 0;
}

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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    int N;
    cin >> N;
    vector<P> xy(N);
    rep(i, N) cin >> xy[i].fi >> xy[i].se;
    sort(all(xy));
    double sum = 0;
    do{
        for(int i = 1; i < N; i++){
            sum = sum + sqrt((double)(xy[i-1].fi - xy[i].fi) * (xy[i-1].fi - xy[i].fi) + (xy[i-1].se - xy[i].se) * (xy[i-1].se - xy[i].se));
        }
    }while(next_permutation(xy.begin(), xy.end()));

    REPS(i, 1, N) {
        sum = (double)sum / i;
    }
    printf("%.12lf\n", sum);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define ull unsigned long long
#define vi vector<ll>
#define vvi vector<vi>
#define DBG_N(hoge) cerr<<" "<<(hoge)<<endl;
#define DBG cerr<<"!"<<endl;
#define BITLE(n) (1LL<<((ll)n))
#define BITCNT(n) (__builtin_popcountll(n))
#define SUBS(s,f,t) ((s).substr((f)-1,(t)-(f)+1))
#define ALL(a) (a).begin(),(a).end()
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d,e;
  string s,ss,sss;
  cin>>s;
  map<string,ll>aa;
  aa["SUN"]=7;
  aa["MON"]=6;
  aa["TUE"]=5;
  aa["WED"]=4;
  aa["THU"]=3;
  aa["FRI"]=2;
  aa["SAT"]=1;
  cout<<aa[s]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include <iostream>

using namespace std;
double dp[100000+1];
int main(){

  int n;
  while( cin >> n ) {
    if(n == 0)break;
    double ans = 0;
    fill(dp, dp +n+1, 0);
    for(int i=0; i<=n; i++){
      double rate = 1, prate=1, base=1 - dp[i];
      for(int j=i+1; j<=n; j++){
		double nrate = rate * prate;
		if(nrate < 0.0000000001)break;
		dp[j] += (nrate * base);
		prate = nrate;
		rate *= 0.5;
      }
      ans += dp[i];
    }
    printf("%0.8lf\n",ans);
  }
}

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

int min(int a,int b){
  if(a<b) return a;
  return b;
}

int main(){

  int N;
  cin >> N;
  vector<int> B(N-1);
  for(int i=0; i<N-1; ++i) cin >> B[i];

  int sum = 0;

  sum += B[0];
  for(int i=1; i<=N-2; ++i){
    sum += min(B[i-1],B[i]);
  }
  sum += B[N-2];

  cout << sum << endl;

  return 0;
}


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

using namespace std;

int n,i,j,cnt[100005];

int main(){
	scanf("%d", &n);
	
	for(i = 0; i < n; i++){
		int x;
		scanf("%d", &x);
		cnt[x]++;
		cnt[x + 1]++;
		cnt[x + 2]++;
	}
	
	int res = 0;
	
	for(i = 0; i < 100002; i++)
	res = max(res, cnt[i]);
	
	printf("%d\n", res);
}


Measured memory_bytes: 640
N,K=(int(x) for x in input().split())

d = []
grid = []
Hu = [0]*N
for i in range(K):
  d.append(int(input()))
  array = list(map(int, input().strip().split()))
  grid.append(array)

#print(N,K,d,grid)

for i in range(K):
  X = grid[i]
  for i in range(N):
    if (i+1) in X:
      Hu[i] = Hu[i] + 1
      #print(i)

print(Hu.count(0))

Measured memory_bytes: 9148
def main():
    n = int(input())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
                res %= mod
            x *= x % mod
            n >>= 1
        return res

    # 全パターン:10 ** n
    all_p = modpow(10, n, mod)
    # 0を含まないパタンーン:9 ** n
    not_0 = modpow(9, n, mod)
    # 9を含まないパターン:9 ** n
    not_9 = modpow(9, n, mod)
    # 0と９を含まないパターン:8 ** n
    not_0_9 = modpow(8, n, mod)
    # 条件のパターン
    ans = all_p - not_0 - not_9 + not_0_9
    print(ans%mod)

if __name__ == '__main__':
    main()

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

int main() {
	int a, b;
	scanf("%d%d", &a, &b);
	int c = b - a;
	printf("%d\n", c * (c - 1) / 2 - a);
        return 0;
}


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

typedef long long ll;

const long double PI = (acos(-1));

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

  string s, t;
  cin >> s >> t;

  int ans;
  for (int i = 0; i < 3; i++){
    if (s.at(i) == t.at(i)) ans++;
  }

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

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

int main()
{
    int d;
    cin>>d;
    if(d==25){
        cout<<"Christmas"<<endl;
    }else if(d==24){
        cout<<"Christmas Eve"<<endl;
    }else if(d==23){
        cout<<"Christmas Eve Eve"<<endl;
    }else{
        cout<<"Christmas Eve Eve Eve"<<endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define itn int
#define REP(i,n) for(int i=0;i<(n);i++)
#define IREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(n);i++)
#define REPEACH(itr,k) for(auto&& itr : k)
#define MOD 1000000007

using namespace std;
typedef long long ll;

const ll INF = 1LL<<60;
typedef pair<double,int> P;


int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> v(n);
  REP(i,n){
    int a;
    cin >> a;
    v[i].first=a;
    v[i].second=i;
  }
  sort(v.begin(),v.end());
  vector<int> ans(n);
  REP(i,n){
    if(i<n/2){
      ans[v[i].second]=v[n/2].first;
    }
    else{
      ans[v[i].second]=v[n/2-1].first;
    }
  }
  REP(i,n){
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 4480
#include <bits/stdc++.h>
using namespace std;
int main()
{
    
    long long int n,m,sum=0;
    cin>>n>>m;
    long long int a[m];
    for(long long int i=0;i<m;i++)
    {cin>>a[i];
    sum+=a[i];
    }
    long long int z=n-sum;
    if(z<0)
    cout<<"-1"<<endl;
    else
    cout<<z<<endl;
    
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, n, k;
  in(n);
  vector<ll> c(n), d(n);
  rep(i, n){
    in2(c[i], d[i]);
  }
  a = c[0];
  b = d[0];
  rep(i, n - 1){
    if(c[i + 1] == c[i] && d[i + 1] == d[i])
      continue;
    if(a % c[i + 1] != 0)
      a = a + c[i + 1] - (a % c[i + 1]);
    k = (a / c[i + 1]) * d[i + 1];
    if(k >= b)
      b = k;
    else{
      if(b % d[i + 1] != 0)
        b = b + d[i + 1] - (b % d[i + 1]);
      a = (b / d[i + 1]) * c[i + 1];
    }
  }
  out(a + b);
  memi;
}


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

int main(void)
{
    string s,t;
    cin >> s >> t;
    sort(s.begin(),s.end());
    sort(t.begin(),t.end(),greater<int>());
    for(int i = 0;i < min(s.size(),t.size());i++)
    {
        if(s[i] < t[i]){cout << "Yes" << endl; return 0;}
        else if(s[i] > t[i]){cout << "No" << endl; return 0;}
    }
    if(s.size() < t.size()){cout << "Yes" << endl;}
    else{cout << "No" << endl;}
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  long long a,b;
  double c;
  cin>>a>>b;
  c=(long long)a/(double)b;
  cout<<a/b<<" "<<a%b<<" ";
  cout<<fixed<<setprecision(6)<<c<<"\n";


  return 0;
}



Measured memory_bytes: 3296
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 2e6 + 87;
const ll MOD = 1e9 + 7;
ll f[N], fi[N];
ll c(ll n, ll k)
{
    return f[n] * fi[k] % MOD * fi[n - k] % MOD;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    f[0] = f[1] = fi[1] = fi[0] = 1;
    for (int i = 2; i < N; ++i) f[i] = i * f[i - 1] % MOD;
    for (int i = 2; i < N; ++i) fi[i] = (MOD - MOD / i) * fi[MOD % i] % MOD; 
    for (int i = 2; i < N; ++i) (fi[i] *= fi[i - 1]) %= MOD;

    ll r1, c1, r2, c2, ans = 0;
    cin >> r1 >> c1 >> r2 >> c2;
    for (ll i = r1; i <= r2; ++i)
        ans += c(c2 + i + 1, i + 1) - c(c1 + i,  i + 1);
    cout << (ans % MOD + MOD) % MOD;
}


Measured memory_bytes: 31488
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
int main() {
	int N;
	string S;
	int R;
	int W;
	int pr;

	cin >> N;
 	vector<int> a(N);
	cin >> S;
	R=0;
	W=0;
   	rep(i,N) {
		if(S.at(i)=='R') {
			R++;
		}
		if(S.at(i)=='W') {
			W++;
		}
	}
	if (R==0){
			cout << 0 << endl;
			return 0;
	}
	if (W==0){
			cout << 0 << endl;
			return 0;
	}
	pr=R;
	rep(i, R){
		if(S.at(i)=='R') {
			pr--;
		}
	}
	cout << pr << endl;
	return 0;
}

Measured memory_bytes: 4412
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)

N, K = getNM()
S = input()

flag = S[0]
sta = 1
lista = []
for i in range(1, N):
    if flag != S[i]:
        lista.append([flag, sta, i])
        flag = S[i]
        sta = i + 1
lista.append([flag, sta, N])
ans = 0
np = len(lista)
for i in range(np):
    if lista[i][0] == '0':
        index = min(i + 2 * K - 1, np - 1)
        opt = lista[index][2] - lista[i][1] + 1
        ans = max(ans, opt)
    else:
        index = min(i + 2 * K, np - 1)
        opt = lista[index][2] - lista[i][1] + 1
        ans = max(ans, opt)
print(ans)

Measured memory_bytes: 62428
//
//  main.c
//  EngSent
//
//  Created by x16017xx on 2016/11/10.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#include <stdio.h>
#include <string.h>

int main(int argc, const char * argv[]) {
    char str[1000][33]={};
    int strId[1000]={};
    char strTmp[33]={};
    int i, j, l = 0;
    int mt=0;
    int cm=0;
    int mm=0;
    char ch;
    // ???????????\???
    for(i=0;i<1000;i++){
        scanf("%c", &ch);
        if(ch==' '||ch=='\n'){
            strTmp[l]='\0';
            for(j=0;strcmp(str[j],"\0")!=0;j++){
                if(0==strcmp(str[j], strTmp)){
                    l=0;
                    break;
                }
            }
            strcpy(str[j], strTmp);
            strId[j]++;
            l=0;
            if(ch=='\n'){
                break;
            }
        }else{
            strTmp[l]=ch;
            l++;
        }
    }
    
    // ????????°????????????????????????
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        if(mt<strId[i]){
            mt=strId[i];
        }
    }
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        if(mt==strId[i]){
            printf("%s ",str[i]);
        }
    }
    // ????????°????????????????????????
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        cm=(int)strlen(str[i]);
        if(mm<cm){
            mm=cm;
        }
    }
    for(i=0;strcmp(str[i],"\0")!=0;i++){
        if(mm==strlen(str[i])){
            printf("%s\n",str[i]);
        }
    }
    return 0;
}

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

using namespace std;

int main(){
  long long N, M, value;
  cin>>N>>M;
  for(int i = 0; i < M; i++){
    cin>>value;
    N -= value;
  }
  if(N<0)
    cout<<-1;
  else
    cout<<N;
}

Measured memory_bytes: 3636
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

macro_rules! trace {
    ($var:expr) => ({
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    })
}
macro_rules! swap { ($a:expr, $b:expr) => ({ let t = $b; $b = $a; $a = t; }) }

fn main() {
    let mut sc = Scanner::new();
    let mut w: i32 = sc.cin();
    let mut h: i32 = sc.cin();

    let mut es = vec![];

    for i in 0..w {
        let p: i32 = sc.cin();
        es.push((p, 0, i));
    }
    for j in 0..h {
        let q: i32 = sc.cin();
        es.push((q, 1, j));
    }
    w += 1;
    h += 1;

    es.sort_by_key(|item| -item.0);
    // trace!(es);

    let mut ans: i64 = 0;

    while w > 1 || h > 1 {
        if let Some((p, d, i)) = es.pop() {
            if d == 0 {
                ans += p as i64 * h as i64;
                w -= 1;
            } else {
                ans += p as i64 * w as i64;
                h -= 1;
            }
            // trace!((p, d, i));
            // trace!((w, h));
        }
    }

    println!("{}", ans);

}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
    fn get_char(&mut self) -> char {
        self.reserve();
        let head = self.buffer[0].chars().nth(0).unwrap();
        let tail = String::from( &self.buffer[0][1..] );
        if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); }
        head
    }
}


Measured memory_bytes: 9084
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
#define rep(i, n) for(int i = 0; i < n; i++)
const int inf9 = 1e9; const lint inf18 = 1e18;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint P(int n, int r){ if(r < 0 || n < r) return 0; return (fact[n] * inv[n - r] % mod); } lint C(int p, int q){ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
template<class itr, class itr2> bool next_sequence2(itr first, itr last, itr2 first2, itr2 last2){ itr now = last; itr2 now2 = last2; while(now != first){ now--, now2--; (*now)++; if((*now) == (*now2)){ (*now) = 0; }else{ return true; } } return false; }
inline int at(lint i, int j){ return (i >> j) & 1; }

int main(){
    int a, b;
    cin >> a >> b;
    if(a < b){
        for(int i = 0; i < b; i++){
            cout << a;
        }
    }else{
        for(int i = 0; i < a; i++){
            cout << b;
        }
    }
    cout << endl;
}





Measured memory_bytes: 256
from collections import defaultdict
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    S = list(input())

    c = 0
    for s in S:
        c += s == "o"
    
    print(700+100*c)




if __name__ == "__main__":
    main()

Measured memory_bytes: 64824
# coding: utf-8


def main():
    N, M, X = map(int, input().split())
    C = [None] * N
    A = [None] * N

    for i in range(N):
        line = list(map(int, input().split()))
        C[i] = line[0]
        A[i] = line[1:]

    min_moneys = []

    def rec(i, scores, money, X):
        if i == N:
            if all([score >= X for score in scores]):
                min_moneys.append(money)
            else:
                return None

        if all([score >= X for score in scores]):
            min_moneys.append(money)
            return None

        rec(i+1, scores, money, X)
        rec(i+1, [scores[j]+A[i][j] for j in range(M)], money+C[i], X)

    rec(0, [0] * M, 0, X)
    
    if len(min_moneys) == 0:
        return -1

    return min(min_moneys)



print(main())


Measured memory_bytes: 9240
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int k, x;
    cin >> k >> x;
    cout << (500 * k >= x ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
from math import sqrt

n, d = map(int, input().split())
x = [list(map(int, input().split())) for _ in range(n)]

def dis(a,b):
    ret = 0
    for i in range(len(a)):
        ret += (a[i] - b[i]) ** 2
    return sqrt(ret)

ans = 0
for i in range(n):
    for j in range(i+1, n):
        dd = dis(x[i], x[j])
        if int(dd) == dd:
            ans += 1
print(ans)

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

#define int long long
#define uint unsigned long long
#define double long double
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define uniq(x) (x).erase(unique(all(x)), (x).end());
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << (x) << endl
using vint=vector<int>;
using vvint=vector<vint>;
using pint=pair<int, int>;
using vpint=vector<pint>;
template<typename T> using priority_queue_rev=priority_queue<T, vector<T>, greater<T>>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int gcd(int a, int b) {
    while (b) { swap(a %= b, b); }
    return a;
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T1, typename T2> bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &rhs) {
    os << "(" << rhs.first << ", " << rhs.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &rhs) {
    os << "{";
    for (auto itr = rhs.begin(); itr != rhs.end(); itr++) {
        os << *itr << (next(itr) != rhs.end() ? ", " : "");
    }
    os << "}";
    return os;
}
struct Setup {
    static constexpr int PREC = 20;
    Setup() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setup;

long long binarySearch(long long ok, long long ng, std::function<bool(int)> check) {
    while (abs(ok - ng) > 1) {
        long long mid = (ok + ng) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    return ok;
}

int N, Q;
string s;
char t[220000], d[220000];
signed main() {
    cin >> N >> Q;
    cin >> s;
    rep(i, Q) { cin >> t[i] >> d[i]; }
    int l = binarySearch(-1, N, [&](int x) {
        int cur = x;
        rep(i, Q) {
            if (t[i] == s[cur]) {
                if (d[i] == 'L') { cur--; }
                if (d[i] == 'R') { cur++; }
            }
            if (cur == -1) { return true; }
            if (cur == N) { return false; }
        }
        return false;
    });
    int r = binarySearch(N, -1, [&](int x) {
        int cur = x;
        rep(i, Q) {
            if (t[i] == s[cur]) {
                if (d[i] == 'L') { cur--; }
                if (d[i] == 'R') { cur++; }
            }
            if (cur == -1) { return false; }
            if (cur == N) { return true; }
        }
        return false;
    });
    cout << N - (l + 1) - (N - r) << endl;
}

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

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#ifdef LOCAL
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define dump(x)
#define debug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long N, long long K){
    ll answer = N;
    N %= K;
    answer = min(N, answer);
    answer = min(answer, K - N);
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


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

using ll = long long;

int n;
vector<ll> dp;
vector<ll> arr;

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

   cin >> n;
   dp = arr = vector<ll>(n+1);
   for(size_t i=1;i<=n;i++)
      cin >> arr[i];
   dp[1]=0;
   dp[2]=abs(arr[2]-arr[1]);
   for(size_t i=3;i<=n;i++)
      dp[i] = min(dp[i-2]+abs(arr[i-2]-arr[i]), dp[i-1]+abs(arr[i-1]-arr[i]));

   cout << dp[n];
   return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> indexs(N);
  int xs[N], ys[N];
  for (int i = 0; i < N; i++) {
    indexs[i] = i;
    cin >> xs[i] >> ys[i];
  }
  double sum = 0.0;
  ll count = 0;
  do {
    for (int i = 1; i < N; i++) {
      double dx = xs[indexs[i - 1]] - xs[indexs[i]];
      double dy = ys[indexs[i - 1]] - ys[indexs[i]];
      sum += sqrt((dx * dx) + (dy * dy));
    }
    count++;
  } while (next_permutation(indexs.begin(), indexs.end()));
  double ans = sum / (ll)count;
  printf("%lf\n", ans);
  return 0;
}

Measured memory_bytes: 3716
N = int(input())
H = list(map(int,input().split()))

H[0] -= 1
flag = True
for i in range(1, N):
    if H[i-1] > H[i]:
        flag = False
    elif H[i-1] < H[i]:
        H[i] -= 1
    
print('Yes' if flag else 'No')

Measured memory_bytes: 14396
#include<stdio.h>
main(){
    int a,b,c,tmp,i,j;
    scanf("%d",&i);
    for(j=1;j<=i;j++){
    scanf("%d %d %d",&a,&b,&c);
     
    if(a>b){tmp=a;a=b;b=tmp;}
    if(b>c){tmp=b;b=c;c=tmp;}
    if(a>b){tmp=a;a=b;b=tmp;}
     
    if(a*a+b*b==c*c)printf("YES\n");
    else printf("NO\n");
    }
    return 0;
}


Measured memory_bytes: 1916
(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let n, m = Scanf.sscanf (read_line ()) "%d %d" ( fun n m -> n, m)

let lst = List.init n ( fun _ -> 
        List.tl (Str.split (Str.regexp " ") (read_line ()))
        |> List.map int_of_string 
        |> Set.of_list
)

(*
let rec f lst =
        match lst with
                  [] -> Set.of_list []
                | first :: [] -> first
                | first :: rest -> 
                        Set.intersect first (f rest)
*)

(*
let () =
        Set.cardinal (f lst)
        |> Printf.printf "%d\n"
*)

let () =
        Set.cardinal (List.fold_left (fun a b -> Set.intersect a b) (List.hd lst) (List.tl lst)) 
        |> Printf.printf "%d\n"


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

vector<string> s(205);
int n;
vector<int> visited(205,0); //探索済みなら1か2


//二部グラフに出来るかを判定
//now:現在の頂点番号
//color:1か2
bool dfs(int now, int color){
    if(visited[now]){ //探索済み
        if(visited[now] != color) return false;
        else return true;
    }
    visited[now] = color;
    rep(next,n){
        if(s[now][next] == '1'){
            if(!dfs(next, 2-((color+1)%2))) return false;
        }
    }
    return true; //分岐が全てtrueならtrue
}

int main(){
    cin >> n;
    rep(i,n) cin >> s[i];
    if(!dfs(0,1)){
        cout << -1 << endl; //2部グラフに出来なければダメ
    }else{
        vector<vector<int>> w(n,vector<int>(n,10000));
        rep(i,n) rep(j,n) if(s[i][j] == '1') w[i][j] = 1;
        rep(i,n) w[i][i] = 0;
        int dist = 0;

        //Warshal-Floyd
        rep(k,n){
            rep(i,n){
                rep(j,n){
                    if(w[i][k] + w[k][j] < w[i][j]){
                        w[i][j] = w[i][k] + w[k][j];
                    }
                }
            }
        }
        rep(i,n) rep(j,n) dist = max(dist, w[i][j]);
        cout << dist + 1<< endl;
    }
}



Measured memory_bytes: 512
#include <stdio.h>
int main(void){
int H ,W;int i, j;
while(1){scanf("%d %d" ,&H ,&W);
if(H == 0 && W == 0) break;
for ( i = 0; i < H; i++ ){
for ( j = 0; j < W; j++ ){
if(j==0||j==W-1||i==0||i==H-1){
printf("#");}else{printf(".");
}
}
printf("\n");
}
puts("");
}
return 0;
}


Measured memory_bytes: 2072
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        

fast();
//ll t;cin>>t;while(t--)
{
   ll r,g,b,n,c=0;
   cin>>r>>g>>b>>n;
   for(int i=0;i<=n;i++)
   {
    for(int j=0;j<=n;j++)
    {
      if(i*r+j*g<=n)
        {
          ll t=(i*r+j*g);
          ll y=n-(i*r+j*g);
          if(y%b==0)
          {
            //cout<<i<<" "<<j<<" "<<y/3<<endl;
             c++;
       }
       }
    }
   } 
   cout<<c<<endl;
}
return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        // R_0を最初に受け取る
        int min = int.Parse(Console.ReadLine());

        // maxValueは最小値を予め設定しておき、i = 1のループで必ず更新されるようにする
        var maxValue = int.MinValue;

        for (var i = 1; i < n; i++)
        {
            var num = int.Parse(Console.ReadLine());

            maxValue = Math.Max(maxValue, num - min);
            min = Math.Min(min, num);
        }

        Console.WriteLine(maxValue);
    }
}



Measured memory_bytes: 20052
#include <iostream>
#include <iomanip>
#include <math.h>
#include <climits>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <map> 
#include <set>
#include <string>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
const ll MD = 1000000007;

/* sample input

*/

ll n, k;
ll x[100005];
int main()
{
	cin >> n >> k;
	for (ll i = 0; i < n; i++) {
		cin >> x[i];
	}

	ll answer = LLONG_MAX;

	ll temp = 0;
	for (ll i = 0; i < n - k+1; i++) {
		if (x[i] * x[i + k - 1] >= 0) {
			temp = max(abs(x[i]), abs(x[i + k - 1]));
		}
		else {
			if (abs(x[i]) > abs(x[i + k - 1])) {
				temp = abs(x[i]) + 2 * abs(x[i + k - 1]);
			}
			else {
				temp = abs(x[i+k-1]) + 2 * abs(x[i]);
			}
		}
		answer = min(temp, answer);
	}

	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

char S[111];
int main()
{
  scanf ("%s",S);
  for (int i=0;S[i];i++){
if (i % 2 == 0 && S[i] == 'L'){
puts("No"); return 0;
}
if (i % 2 == 1 && S[i] == 'R'){
puts("No"); return 0;
}
  }
  puts("Yes");
return 0;
}


Measured memory_bytes: 3160
#include<stdio.h>
int main(void){
	int n,q;
	scanf("%d %d\n",&n,&q);
	char s[n];
	scanf("%s",s);
	int i=0;
	int h[n];
	h[0]=0;
	for(i=0;i<n-1;i++){
		if(s[i]=='A'&&s[i+1]=='C') h[i+1] = 1+h[i];
		else h[i+1]=h[i];
	}
	int k[2][q];
	for(i=0;i<q;i++)scanf("%d %d\n",&k[0][i],&k[1][i]);
	for(i=0;i<q;i++){
		int a=h[k[1][i]-1]-h[k[0][i]-1];
		printf("%d\n",a);
	}
	return 0;
}

Measured memory_bytes: 2048