akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

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

    int n,m,x,b;
    cin >> n >> m >> x;
    int a[n];

    rep(i,n){
        a[i] = 0;
    }

    rep(i,m){
        cin >> b;
        a[b]++;
    }
    int counta=0,countb=0,tmp = x;

    while(1){
        tmp++;
        if(tmp == n) break;
        if(a[tmp] == 1) counta++;
        //cout << "a = " << counta << endl;
    }

    while(1){
        x--;
        if(x == 0) break;
        if(a[x] == 1) countb++;
        //cout << "b = " << x << endl;
    }

    cout << min(counta,countb) << endl;


    return 0;
}

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

int main(){
    int n, i;
    cin >> n;
    for(i=0; i<=n/7; i++){
        if((n-7*i)%4 == 0){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
    return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split(" "))
ab = [list(map(int, input().split(" "))) for _ in range(m)]

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

count = 0
x = 0
for a_i, b_i in ab:
	if a_i <= x < b_i:
		continue
	x = b_i-1
	count += 1

print(count)

Measured memory_bytes: 29452
// Copyright 2019 yaito3014
#include "bits/stdc++.h"
using namespace std;
using namespace literals;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<int> p(M);
  vector<string> s(M);
  for (int i = 0; i < M; ++i)
    cin >> p[i] >> s[i];
  vector<int> WA(N, 0);
  vector<bool> AC(N, false);
  for (int i = 0; i < M; ++i) {
    --p[i];
    if (AC[p[i]])continue;
    if (s[i] == "AC")AC[p[i]] = true;
    else ++WA[p[i]];
  }
  for (int i = 0; i < N; ++i)if (!AC[i])WA[i] = 0;
  int AC_sum = count(begin(AC), end(AC), true);
  int WA_sum =accumulate(begin(WA), end(WA), 0);
  cout << AC_sum << " " << WA_sum << endl;
}


Measured memory_bytes: 6528
s = input()
q = int(input())
t = []
 
def F(f,fr,ba,c):
  if f == '1':
     return c + fr, ba
  if f == '2':
    return fr,ba + c

def R(r):
  if r == '1':return '2'
  if r == '2':return '1'

ans = s
fr = ''
ba = ''
r = '1'
for n in range(q):
  t = input().split()
  if t[0] == '1':
    r = R(r)
  else:
    if r =='2':
      t[1] = R(t[1])
    fr, ba = F(t[1],fr,ba,t[2])
 
    
if r == '1': 
   print(fr + ans + ba)
else:
  print(ba[::-1] + ans[::-1]+ fr[::-1])

Measured memory_bytes: 4576
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1e9+7))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define sqrt sqrtl
#define cbrt cbrtl
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi; 


int32_t main()
{
	IOS
	int n;cin>>n;
	vector<vector<int>>v(n,vector<int>(3));
	for(int i=0;i<n;i++)
	for(int j=0;j<3;j++)
	cin>>v[i][j];
	
	vector<vector<int>>dp(n,vector<int>(3));
	for(int j=0;j<3;j++)
	dp[0][j]=v[0][j];
	
	for(int i=1;i<n;i++)
	{
		for(int j=0;j<3;j++)
		{
			dp[i][j]=max( dp[i-1][(j+1)%3] , dp[i-1][(j+2)%3] ) + v[i][j];
		}
	}
	cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}
		


Measured memory_bytes: 11264
#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
int main(){
  string S, T, F, C, left, right;
  int Q;
  int count = 0;
  cin >> S;
  cin >> Q;
  for (int i = 0; i < Q; ++i){
    cin >> T;
    if (T == "1"){
      count += 1;
    } else {
      cin >> F >> C;
      if (F == "1"){
        if (count % 2 == 0){    
            left += C;
        } else {
            right += C;
        }
      } else {
        if (count % 2 == 1){
            left += C;
        } else {
            right += C;
        }
      }
    }
  }
  if (count % 2 == 0){
    reverse(left.begin(), left.end());
	cout << left << S << right << "\n";    
  } else {
    reverse(right.begin(), right.end());
    reverse(S.begin(), S.end());
	cout << right << S << left << "\n";    
  }

}

Measured memory_bytes: 1088
from collections import deque


def bfs(maze, visited, sy, sx, gy, gx):
    queue = deque([[sy, sx]])
    visited[sy][sx] = 0
    while queue:
        # queueには訪れた地点が入っている。そこから、4方向に移動できるか考え、queueから消す。
        y, x = queue.popleft()  # queueに入っていたものを消す。
        if [y, x] == [gy, gx]:  # もしゴールについていたならば、そのときの手数を出す。
            return visited[y][x]
        for dx, dy in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            for k in range(1, K + 1):
                new_x = x + dx * k
                new_y = y + dy * k
                
                if (0 <= new_y < H) and (0 <= new_x < W):
                    if maze[new_y][new_x] == "@":
                        break
                    elif visited[new_y][new_x] == -1:  # まだ来たことない点だったという条件
                        visited[new_y][new_x] = visited[y][x] + 1
                        queue.append([new_y, new_x])  # 新しい点を足す。
                    elif visited[new_y][new_x] < visited[y][x] + 1:
                        break
                else:
                    break


H, W, K = map(int, input().split())
# K = min(K, max(H, W))
x1, y1, x2, y2 = map(int, input().split())
x1, y1, x2, y2 = x1 - 1, y1 - 1, x2 - 1, y2 - 1
C = [0] * H
for i in range(H):
    C[i] = str(input())
visited = [[-1] * W for i in range(H)]
bfs(C, visited, x1, y1, x2, y2)
# print(visited)
print(visited[x2][y2])

Measured memory_bytes: 36888
#include <iostream>
#include <vector>
#include <bitset>
#include <functional>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <tuple>
using namespace std;

template <class T> void chmax(T &x, T y) {if(x<y) x=y;}
template <class T> void chmin(T &x, T y) {if(x>y) x=y;}



main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);

    long long a,b,c;
    cin>>a>>b>>c;
    if(a+b>c)
    {
        cout << "No" << "\n";
    }
    else
    {
        if(4*a*b<(c-a-b)*(c-a-b))
        {
            cout << "Yes" << "\n";
        }
        else
        {
            cout << "No" << "\n";
        }
    }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void Main() {
    ll n, i; cin >> n >> i;
    cout << n - i + 1 << endl;
}

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


Measured memory_bytes: 3568
#include <stdio.h>
#include <cstring>

constexpr int N = 5e5;
long long int res = 0;
long long int A[N];
char str[N+10];

int main(void){
    scanf("%s", str);
    const int n = strlen(str);
    int idx = 0, sz = 0;
    while(idx < n){
        long long int r = 0, l = 0;
        while(idx + r < n and str[idx + r] == '<') r++;
        idx += r;
        while(idx + l < n and str[idx + l] == '>') l++;
        idx += l;
        if(r < l){long long int tmp = r; r = l; l = tmp;}
        res += r * (r + 1) / 2;
        res += l * (l - 1) / 2;
    }
    printf("%lld\n", res);
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>
#include <vector>

using namespace std;
typedef long long LL;
const int maxn = 151072;
const LL inf = 1ll<<50;

typedef pair<LL,LL> mp;
typedef vector<mp> vc;
#define fi first
#define se second
#define pb push_back

vc node[maxn],p,q;
void add(vc &c,int w)
{
	int n=c.size();
	for (int i=0;i<n;i++)
		c[i].fi+=w,c[i].se+=w;
}
void merge(vc &c,vc &a,vc &b,LL lim)
{
	c.clear();p.clear();q.clear();
	int n=a.size(),m=b.size();
	for (int i=0,j=-1;i<n;i++)
	{
		int las=j;while (j+1<m&&b[j+1].fi+a[i].se<=lim) ++j;
		if (las!=j) p.pb(mp(a[i].fi,b[j].se)),las=j;
	}
	for (int j=0,i=-1;j<m;j++)
	{
		int las=i;while (i+1<n&&a[i+1].fi+b[j].se<=lim) ++i;
		if (las!=i) q.pb(mp(b[j].fi,a[i].se)),las=j;
	}
	
	n=p.size();m=q.size();LL lv=inf;
	for (int i=0,j=0;i<n||j<m;)
	{
		if (i>=n)
			{if (q[j].se<lv) c.pb(q[j]),lv=q[j].se;++j;}
		else if (j>=m)
			{if (p[i].se<lv) c.pb(p[i]),lv=p[i].se;++i;}
		else {
			LL u=p[i].fi,v=q[j].fi;
			if (u<v)
				{if (p[i].se<lv) c.pb(p[i]),lv=p[i].se;++i;}
			else if (u>v)
				{if (q[j].se<lv) c.pb(q[j]),lv=q[j].se;++j;}
			else {
				if (p[i].se<q[j].se)
					{if (p[i].se<lv) c.pb(p[i]),lv=p[i].se;}
				else
					{if (q[j].se<lv) c.pb(q[j]),lv=q[j].se;}
				++i;++j;
			}
		}
	}
}

int son[maxn][3],n,idx,loc[maxn],f[maxn],a[maxn];
void print(int i)
{
	printf("%d size %d\n",i,node[i].size());
	for (int j=0;j<node[i].size();j++)
		printf("(%lld,%lld) ",node[i][j].fi,node[i][j].se);puts("");
}
void dfs(int u)
{
	if (son[u][0]) {
		loc[++idx]=u;
		dfs(son[u][1]);
		dfs(son[u][2]);
	}
}
int main()
{
	scanf("%d",&n);
	for (int i=2;i<=n;i++)
		scanf("%d %d",&f[i],&a[i]),
		son[f[i]][++son[f[i]][0]]=i;
	for (int i=1;i<=n;i++)
		if (!son[i][0]) node[i].pb(mp(a[i],a[i]));
		
	dfs(1);
	LL lb=-1,rb=1ll<<35;
	while (rb-lb>1)
	{
		LL mid=lb+rb>>1;
		for (int i=idx;i>=1;i--)
		{
			int x=loc[i],u=son[x][1],v=son[x][2];
			merge(node[x],node[u],node[v],mid);
			add(node[x],a[x]);
		}
		if (node[1].size()) rb=mid;else lb=mid;
	}
	printf("%lld",rb);
	return 0;
}

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

#ifdef LOCAL
#define debug(var) cerr << #var << " = " << var;
#else
#define debug(var)
#endif

void init() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
}

void solve() {
	long long n, a, b; cin >> n >> a >> b;
	long long ans = n/(a+b);
	cout << ans*a + min(a, n%(a+b));
}

int main() {
	init();
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  bool flag=false;
  for(int i=0;i<s.size();i++){
    if(s[i]=='9'){
      flag = true;
      break;
    }
  }
  if(flag){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
}


Measured memory_bytes: 256
n, k, q = map(int, input().split())
#a = [int(input()) for _ in range(q)]
ans = [k - q] * n

for i in range(q):
    ans[int(input()) - 1] += 1

for t in ans:
    if t > 0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 76584
#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 k;
  cin >> k;
  vector<int> d;
  for (int i=1; i<=k; i++) {
    for (int j=1; j<=k; j++) {
      d.push_back(__gcd(i,j));
    }
  }
  ll sum = 0;
  for (int i=1; i<=k; i++) {
    for (int j=0; j<d.size(); j++) {
      sum += __gcd(i, d[j]);
    }
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 3756
import scala.io.StdIn._
object Main extends App {
  val Array(n, q) = readLine.split(" ").map(_.toInt)
  val s = readLine
  var ac = new Array[Int](s.size)
  for (i <- 1 until s.length) {
    ac(i) =
      if (s(i - 1) == 'A' && s(i) == 'C') ac(i - 1) + 1
      else ac(i - 1)
  }
  (1 to q).foreach { _ =>
    val Array(l, r) = readLine.split(" ").map(_.toInt)
    println(ac(r-1) - ac(l - 1))
  }

}


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

#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;



int main(void) {
	int prime[100000] = {};
	int pos = 0;
	bool flag = false;
	prime[1] = 6;
	pos = 2;
	for (int i = 8; i <= 300000; flag ? i += 5 : i += 2) {
		FOR(t, 1, pos - 1) {
			if (i%prime[t] == 0) {
				break;
			}
			if (t == pos - 1) {
				prime[pos] = i;
				pos++;
			}
		}
		if (flag) {
			flag = false;
		}
		else {
			flag = true;
		}
	}

	while (1) {
		int n;

		cin >> n;
		if (n == 1) {
			break;
		}
		cout << n << ":";
		FOR(i, 1, pos - 1) {
			if (n%prime[i] == 0) {
				cout << " " << prime[i];
			}
		}
		cout << endl;
	}
}


Measured memory_bytes: 3404
#include<cstdio>
#include<algorithm>

using namespace std;

const int inf=500000000;
int wf_l[200][200],wf_s[200][200],memo[1000][200];

int main()
{
	for(int n,m;scanf("%d%d",&n,&m),n;){
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)	wf_l[i][j]=wf_s[i][j]=(i==j?0:inf);
		for(int i=0;i<m;i++){
			int x,y,t;
			char sl;	scanf("%d%d%d %c",&x,&y,&t,&sl);
			x--;	y--;
			if(sl=='S')	wf_s[x][y]=wf_s[y][x]=min(wf_s[x][y],t);
			if(sl=='L')	wf_l[x][y]=wf_l[y][x]=min(wf_l[x][y],t);
		}

		for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)wf_l[i][j]=min(wf_l[i][j],wf_l[i][k]+wf_l[k][j]);
		for(int k=0;k<n;k++)for(int i=0;i<n;i++)for(int j=0;j<n;j++)wf_s[i][j]=min(wf_s[i][j],wf_s[i][k]+wf_s[k][j]);

		int r,from,to;	scanf("%d%d",&r,&from);	from--;
		for(int j=0;j<n;j++)	memo[0][j]=(j==from?0:inf);
		for(int i=1;i<r;i++){
			scanf("%d",&to);	to--;
			for(int j=0;j<n;j++){
				memo[i][j]=inf;
				for(int k=0;k<n;k++){
					if(j==k)	memo[i][j]=min(memo[i][j],memo[i-1][k]+wf_l[from][to]);
					memo[i][j]=min(memo[i][j],memo[i-1][k]+wf_l[from][k]+wf_s[k][j]+wf_l[j][to]);
				}
			}
			from=to;
		}

		int tmin=inf;
		for(int j=0;j<n;j++)	tmin=min(tmin,memo[r-1][j]);
		printf("%d\n",tmin);
	}

	return 0;
}

Measured memory_bytes: 1856
#include<stdio.h>

int main(void) {
  char str1[4];
  char str2[4];
  scanf("%s%s", &str1, &str2);
  
  if(str1[0] == str2[2] && str1[1] == str2[1] && str1[2] == str2[0]) { 
    puts("YES"); 
  } else {
  	puts("NO");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
using namespace std;

int main()
{
  int A,B;
  cin>>A>>B;
  int ans = B-A;
  if(B%A==0) ans=A+B;
  cout<< ans <<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<stdio.h>
int data[101];
void format(){
int i;
for(i=100;i--;){
data[i]=0;
}
}
int main(){
format();
int i;
while((scanf("%d",&i))!=EOF){
data[i]++;
if(data[0]<data[i]){
data[0]=data[i];
}
}
for(i=100;i--;){
if(data[100-i]==data[0]){
printf("%d\n",100-i);
}
}
return 0;
}

Measured memory_bytes: 1188
import math

N,K = map(int, input().split())

p = 0.0

if K>N:
    tp = 0.0
    for i in range(1,N+1):#1~N
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / N
    print(tp)
elif K == 1:
    print(1.0)
else:
    p = (N-K+1.0)/N#No coin
    tp = 0.0
    for i in range(1,K):#1~K-1
        #deme i
        tp += 0.5**math.ceil(math.log2(K/i))
    tp = tp / (K-1.0)
    print(p+(1.0-p)*tp)



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

typedef vector<int> vi;
#define ll long long
#define loop(i,n) for(int i=0; i<n; i++)
#define loop1(i,n) for(int i=1; i<=n; i++)
#define loopi(i,s,e) for(int i=s; i < e; i++)
#define loopiRev(i,s,e) for(int i=s; i >= e; i--)
#define PI 3.14159265359
#define x first
#define y second
#define point pair<int,int>
#define len(s)   (int)s.length()
#define sz(v)    (int)v.size()
#define all(a)   a.begin(),a.end()
#define clr(x, val)	memset((x), (val), sizeof(x))

//you don't know math, unless you can do math!
ll pow_(ll b, ll p){
    if(p == 0) return 1;

    if(p&1) return b * pow_(b*b, p/2);
    else return pow_(b*b, p/2);
}

ll co[1000000];
ll values[1000000];

ll evaluate(int val, int n){
    ll res=0;
    loop(i, n){
        res += co[i] * pow_(val, n-i-1);
    }

    return res;
}

int main() {
    //freopen("input.txt" , "r" , stdin) ;
    //freopen("output.txt" , "w" , stdout) ;

    //cin.tie(0);
    //cin.sync_with_stdio(0);

    string s;
    cin>>s;

    if(s[2] == s[3] && s[4] == s[5])
        cout<<"Yes";
    else cout<<"No";
}



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

int main(){
	int n;
	while(1){
		cin >> n;
		if(n == -1) break;
		if(n > 30){
			cout << 4280 - (1150 + 10*125 + 10*140 + (n-30)*160) << endl;
		}
		else if(n > 20){
			cout << 4280 - (1150 + 10*125 + (n-20)*140) << endl;
		}
		else if(n > 10){
			cout << 4280 - (1150 + (n-10)*125) << endl;
		}
		else {
			cout << 4280 - 1150 << endl;
		}
	}
}

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

using namespace std;

int main(){
    int K,T,run,lst=-1,ans=0,sum=0;
    cin >> K >> T;
    vector<int> a(T);
    for(int i=0;i<T;i++){
        cin >> a[i];
        sum += a[i];
    }

    sort(a.begin(),a.end());

    if(a.back()<=1+sum-a.back()){
        cout << 0 << endl;
    }else{
        cout << 2*a.back()-sum-1 << endl;
    }
}


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

int main(){
    
string s;
  cin>>s;
  int cnt=0;
  int i=0;
  int n=s.size();
  while(i<n/2){
  	if(s[i]!=s[n-1-i]){
      cnt++;
  	}
  	i++;
  }

  cout<<cnt<<endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
  int a, b, c, d;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  
  int dx = c - a;
  int dy = d - b;
  
  int e = c - dy;
  int f = d + dx;
  
  int g = e - dx;
  int h = f - dy;
  
   printf("%d %d %d %d", e, f, g, h);
}

Measured memory_bytes: 764
#include<bits/stdc++.h>
using namespace std;
using p = pair<int,long long>;
using ll = long long;
const auto INF =(ll)1e5;
int main(){
  int n;
  int d,x;
  cin >> n >> d >> x;
  auto a = vector<int>(n,0);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }

  auto sum = 0;
  for(int i = 1;i<=d;i++){
      for(auto j:a){
          if((i-1)%j==0){
            sum++;
          }
      }
  }
  cout << sum+x;
}

Measured memory_bytes: 256
#include<cstdio>

int main(){
    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++){
    printf ("#");
    }
    printf ("\n");
}
printf ("\n");
}
}


Measured memory_bytes: 2592
package main

import "fmt"

func main() {
	var n int
	var s string

	fmt.Scan(&n)
	fmt.Scan(&s)

	cnt := 1
	for i := 0; i < len(s)-1; i++ {
		if s[i] != s[i+1] {
			cnt++
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
using namespace std;

typedef pair<int,int> P;

int n, d;
string t[202];
map<string, set<int> > idx;

vector<string> getV(string v){
  vector<string> res;
  string s = v;

  for(int a = 0; a < s.length() - 1; a++){
    swap(s[a], s[a + 1]);
    res.push_back(s);
    swap(s[a], s[a + 1]);
  }

  for(char ch = 'a'; ch <= 'z'; ch++){
    for(int j = 0; j < v.length(); j++){
      s = v;
      s[j] = ch;
      res.push_back(s);
      s[j] = v[j];
    }

    for(int j = 0; j < v.length() + 1; j++){
      s = v.substr(0, j) + ch + v.substr(j);
      res.push_back(s);
    }
  }

  for(int j = 0; j < v.length(); j++){
    s = v.substr(0, j) + v.substr(j + 1);
    res.push_back(s);
  }

  return res;
}

int main(){
  while(cin >> n, n){
    cin >> d;

    for(int i = 0; i < n; i++){
      cin >> t[i];
    }
    sort(t, t + n);

    idx.clear();

    for(int i = 0; i < n; i++){
      vector<string> v = getV(t[i]);

      for(int j = 0; j < v.size(); j++){
        idx[v[j]].insert(i);
      }
    }

    set<P> ans;

    for(int i = 0; i < n; i++){
      for(int j = i + 1; j < n; j++){
        if(idx[t[j]].find(i) != idx[t[j]].end()){
          ans.insert(P(i, j));
        }
      }
    }

    if(d == 2){
      for(map<string,set<int> >::iterator iter = idx.begin(); iter != idx.end(); iter++){
        set<int> stt = iter->second;
        for(set<int>::iterator iter2 = stt.begin(); iter2 != stt.end(); iter2++){
          for(set<int>::iterator iter3 = stt.begin(); iter3 != stt.end(); iter3++){
            if(*iter2 < *iter3)
              ans.insert(P(*iter2, *iter3));
          }
        }
      }
    }

    for(set<P>::iterator iter = ans.begin(); iter != ans.end(); iter++){
      P p = *iter;
      cout << t[p.first] << "," << t[p.second] << endl;
    }

    cout << ans.size() << endl;
  }
}

Measured memory_bytes: 29300
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    A=LIST()
    ct=0
    flg=1
    while flg==1:
        for i in range(n):
            if A[i]%2==1:
                flg=0
            else:
                A[i]=A[i]//2
        if flg==1:
            ct+=1
    print(ct)
            
        
if __name__ == '__main__':
    do()

Measured memory_bytes: 3188
import java.util.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
 
        while(sc.hasNext()){
 
        double a = sc.nextDouble();
        double b = sc.nextDouble();
        double c = sc.nextDouble();
        double d = sc.nextDouble();
        double e = sc.nextDouble();
        double f = sc.nextDouble();
 
        BigDecimal x = new BigDecimal((c*e-b*f)/(a*e-b*d));
        BigDecimal y = new BigDecimal((c*d-a*f)/(b*d-a*e));
 
        x = x.setScale(3, BigDecimal.ROUND_HALF_UP);
        y = y.setScale(3, BigDecimal.ROUND_HALF_UP);
 
        System.out.printf("%.3f ",x);
        System.out.printf("%.3f\n",y);
 
    }
 
    }
}

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

// typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'
#define DEBUGP(x) cerr << #x << ": " << x.first << " \t" << x.second << '\n'

int a, p;
signed main()
{
    cin >> a >> p;

    cout << (3*a + p)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<P,ll> PP;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define S 31
ll n, C;
vector<PP> v;
ll cnt[S];

ll solve(){
	priority_queue<P, vector<P>, greater<P> > q;
	ll res = 0, time = 0, siz = 0;
	rep(i, n){
		if(q.empty()){
			;
		} else {
			if(time<v[i].fst.fst){
				time = v[i].fst.fst;
				siz = 0;
				mset(cnt, 0);
				while(!q.empty() && v[i].fst.fst>q.top().fst) q.pop();
				while(!q.empty() && v[i].fst.fst==q.top().fst){
					siz++;
					cnt[q.top().snd]++;
					q.pop();
				}
			}
			if(cnt[v[i].snd]){
				siz--;
				cnt[v[i].snd]--;
			}
		}
		q.push(P(v[i].fst.snd, v[i].snd));
		res = max(res, (ll)q.size()+siz);
		//cerr<<i<<" "<<res<<endl;
	}
	return res;
}

int main(){
	cin>>n>>C;
	v = vector<PP>(n);
	rep(i, n){
		int s, t, c;
		cin>>s>>t>>c;
		v[i] = PP(P(s, t), c);
	}
	sort(all(v));
	/*ll lb = 0, ub = n;
	  while(ub-lb>1){
	  ll md = (lb+ub+1)/2;
	  (check(md)?ub:lb) = md;
	  }
	  cout<<ub<<endl;
	  */
	cout<<solve()<<endl;
	return 0;
}


Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
using namespace std;
int main(){
    int a,b;
    int t = 0;
    cin >> a >> b;
    for(int i = 0; i <= b-a; i++){
        t += i;
    }
    cout << t-b << endl;
}

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

int N;

int main() {
  cin >> N;
  if(N == 3) {
    cout << 2 << " " << 5 << " " << 63 << endl;
  } else {
    int E = N - 2 <= 15000 ? N - 2 : 15000 - N % 2;
    for(int i = 1; i <= N - E; ++i) cout << (i == 1 ? "" : " ") << 3 * (2 * i - 1);
    int K = (E + 2) / 3 * 3;
    for(int i = 4; i <= K; ++i) cout << " " << 2 * i;
    if(E % 3 == 0) cout << " " << 2 << " " << 4 << " " << 6;
    else if(E % 3 == 2) cout << " " << 2 << " " << 4;
    else cout << " " << 6;
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  double r;cin>>r;
  double s = M_PI*r*r;  
  double l = 2*M_PI*r;
  cout<<fixed<<s<<" "<<l<<endl;
}



Measured memory_bytes: 3236
#include<cstring>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<vector>
using namespace std;
const int maxn = 1005 + 20;
int vis[2000505],n;
double x[2000505],y[2000055];
double r[2000505];
double dist[2000550],mp[maxn][maxn];
void SPFA(int s) {
	queue<int>q;
	for(int i = 1; i <= n; i++)
		dist[i] = 1e10;
	memset(vis,0,sizeof(vis));
	while(!q.empty()) q.pop();
	dist[s] = 0;
	vis[s] = 1;
	q.push(s);
	while(!q.empty()) {
		int v = q.front();
		q.pop();
		vis[v] = 0;
		for(int i = 1; i <= n; i++) {
			if(dist[i] > dist[v] + mp[v][i]) {
				dist[i] = dist[v] + mp[v][i];
				if(!vis[i]) {
					vis[i] = 1;
					q.push(i);
				}
			}
		}
	}
}
int main() {
	while(scanf("%lf%lf%lf%lf",&x[1],&y[1],&x[2],&y[2]) != EOF) {
		scanf("%d",&n);
		n += 2;
		r[1] = r[2] = 0;
		mp[1][2] = mp[2][1] = sqrt((x[1]-x[2]) * (x[1]-x[2]) + (y[1]-y[2]) * (y[1]-y[2]));
		for(int i = 3; i <= n; i++) {
			scanf("%lf%lf%lf",&x[i],&y[i],&r[i]);
		}
		for(int i = 1; i <= n; i++) {
			for(int j = 1; j <= n; j++) {
				mp[i][j] = sqrt((x[i]-x[j]) * (x[i]-x[j]) + (y[i]-y[j]) * (y[i]-y[j]));
				mp[i][j] -= r[i] + r[j];
				if(mp[i][j] < 0) {
					mp[i][j] = 0;
				}
			}
		}
		SPFA(1);
		printf("%.10f\n",dist[2]);
	}
	return 0;
}

Measured memory_bytes: 25600
#include <stdlib.h>
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
using ll=long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
const long long INF=1LL << 60;
long long a,b;
long long dp[100200][110];
long long w[110],v[110];


int main(){
    string s;
    cin>>s;
    if(s=="ARC"){
        cout<<"ABC"<<endl;
    }
    else{
        cout<<"ARC"<<endl;
    }
}



Measured memory_bytes: 3624
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Data.Functor
import Data.Function
import Data.Monoid
import Data.Maybe
import Data.List
import qualified Data.Foldable as Foldable
import Data.List.Split
import Data.Bits
import Data.Char
import Data.Ix
import Data.Ratio
import Data.Ord
import Data.Tuple
import Data.Array
import Data.Array.IO
import Data.Array.ST
import Data.IORef
import Data.STRef
-- import System.IO.Unsafe
 
readInt = read :: String -> Int
readDouble = read :: String -> Double
getInt = readLn :: IO Int
getInts = map readInt . words <$> getLine
getDouble = readLn :: IO Double
sjoin :: (Show a) => [a] -> String
sjoin = unwords . map show
cond :: a -> a -> Bool -> a
cond t f c = if c then t else f
apply2 :: (a -> a -> b) -> [a] -> b
apply2 f [x,y] = f x y
apply3 :: (a -> a -> a -> b) -> [a] -> b
apply3 f [x,y,z] = f x y z
fnBin :: (b -> c -> d) -> (a -> b) -> (a -> c) -> a -> d
fnBin op f g x = op (f x) $ g x
fnTuple :: (a -> b, a -> c) -> a -> (b, c)
fnTuple (f,g) a = (f a, g a)
replace :: (Eq a) => a -> a -> [a] -> [a]
replace x y = map (\z -> if z==x then y else z)
modifyArray :: (Ix i, MArray a e m) => a i e -> i -> (e -> e) -> m ()
modifyArray arr ix f = readArray arr ix >>= writeArray arr ix . f
-- end of templete


main = do
    [n, k] <- getInts
    when (n/=0 || k/=0) $ do
        a <- replicateM n getInt
        let s = scanl (+) 0 a
        print $ maximum $ zipWith (-) (drop k s) s
        main

Measured memory_bytes: 55300
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num_traits::clamp;
use ordered_float::OrderedFloat;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout]
fn main() {
    input! {
        h: usize, w: usize,
        ch: Usize1, cw: Usize1,
        dh: Usize1, dw: Usize1,
        s: [Chars; h]
    }

    let mut visited = vec![vec![1i64<<60; w]; h];
    visited[ch][cw] = 0;
    let mut que = BinaryHeap::new();
    que.push((Reverse(0), cw, ch));
    while let Some((Reverse(count), x, y)) = que.pop() {
        if x == dw && y == dh {
            println!("{}", count);
            return;
        }

        let d = [(1, 0), (-1, 0), (0, 1), (0, -1)];
        for &(dx, dy) in &d {
            let x2 = clamp(x as isize + dx, 0, w as isize - 1) as usize;
            let y2 = clamp(y as isize + dy, 0, h as isize - 1) as usize;
            if s[y2][x2] == '.' && count < visited[y2][x2] {
                visited[y2][x2] = count;
                que.push((Reverse(count), x2, y2));
            }
        }
        for dy in -2..=2 {
            for dx in -2..=2 {
                let x2 = clamp(x as isize + dx, 0, w as isize - 1) as usize;
                let y2 = clamp(y as isize + dy, 0, h as isize - 1) as usize;
                if s[y2][x2] == '.' && count + 1 < visited[y2][x2] {
                    visited[y2][x2] = count + 1;
                    que.push((Reverse(count + 1), x2, y2));
                }
            }
        }

    }
    println!("-1");
}


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

long long n, ans = 0;

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    long long a = 0;
    cin >> a;
    while(a % 2 == 0) {
      ++ans;
      a /= 2;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int N;
map<int, int> mp;

int main() {
  cin >> N;
  rep(i, 0, N) {
    int a;
    cin >> a;
    ++mp[a];
  }

  int ans = 0;
  for (auto e : mp) {
    if (e.second % 2 == 1) {
      ++ans;
    }
  }
  cout << ans;
}


Measured memory_bytes: 8196
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n; cin>>n;
  vector<int> h(n),dp(n);
  for(int i=0; i<n ; i++)
    cin>>h[i];
  dp[0]=0; dp[1]=abs(h[1]-h[0]);
    for(int i=2; i<n; i++) dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
  cout<<dp[n-1];
  return 0;
}

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

#define MP make_pair
#define PB push_back
#define ALL(x)      (x).begin(),(x).end()
#define REP(i,n)    for(int i=0;i<(n);i++)
#define REP1(i,n)   for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n)   for(int i=(n);i>=0;i--)
#define CLR(a)      memset((a),0,sizeof(a))
#define MCLR(a)     memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
 
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;
 
const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;
 
const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};


void solve(long long N, long long K){
    cout << (N - K + 1) << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    solve(N, K);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main(void) {

	int i = 0, n, h, w, m = -1,j=0,l=0;
	int H[300], W[300];

	do {

		m = m + 1;
		cin >> H[m] >> W[m];

	} while (H[m] != 0 && W[m] != 0);

	do {

		h = H[i];
		w = W[i];

		if (h == 0 && w == 0) {
			break;
		}

		else {

			for (n = 0; n < h; n++) {

				j = 0;

				for (int i = j+l; i < w+l; i++) {

					if (i % 2 == 0)
						cout << "#";

					else if (i % 2 == 1)
						cout << ".";

				}
				cout << endl;
				l = l + 1;
			}

			cout << endl;

			i++;
			l = 0;

		}
	} while (i);

}

Measured memory_bytes: 3064
#include <algorithm>
#include <cstdio>
inline int gcd(int x, int y)
{
	while (y)
	{
		int r = x % y;
		x = y;
		y = r;
	}
	return x;
}
const char ans[][15] = {"First", "Second"};
int arr[100005];
int main()
try
{
	// freopen("AGC010-D.in", "r", stdin);
	int n, cur = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
		scanf("%d", arr + i);
	while (true)
	{
		int cnt = 0;
		std::for_each(arr, arr + n, [&] (int x) { cnt += x & 1 ^ 1; });
		if (cnt & 1)
			throw ans[cur];
		if (n - cnt >= 2)
			throw ans[cur ^ 1];
		int g = 0;
		for (int i = 0; i < n; i++)
		{
			if (arr[i] == 1)
				throw ans[cur ^ 1];
			g = gcd(arr[i] - (arr[i] & 1), g);
		}
		std::for_each(arr, arr + n, [&] (int &x) { x /= g; });
		cur ^= 1;
	}
	return 0;
}
catch (const char *str)
{
	puts(str);
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	string w; cin >> w;
	vector<int> a(26, 0);
	rep(i, w.size()){
		a[w[i]-'a']++;
	}
	rep(i, 26){
		if(a[i] % 2 != 0){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
priority_queue<pair<int,pair<int,int> > >q;
const int maxn=1e3+10;
int x,y,z,k,a[maxn],b[maxn],c[maxn],d[maxn*3],ans[maxn*3];
inline bool cmp(int x,int y)
{
	return x>y;
}
signed main()
{
	scanf("%lld%lld%lld%lld",&x,&y,&z,&k);
	for(register int i=1;i<=x;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+x+1,cmp);
	for(register int i=1;i<=y;i++)
		scanf("%lld",&b[i]);
	sort(b+1,b+y+1,cmp);
	for(register int i=1;i<=z;i++)
		scanf("%lld",&c[i]);
	sort(c+1,c+z+1,cmp);
	q.push(make_pair(a[1]+b[1],make_pair(1,1)));
	int len=min(k,x*y);
	for(register int cas=1;cas<=len;cas++)
	{
		int i=q.top().second.first,j=q.top().second.second;
		d[cas]=q.top().first;
		q.pop();
		if(j<y)
			q.push(make_pair(a[i]+b[j+1],make_pair(i,j+1)));
		if(j==1 && i<x)
			q.push(make_pair(a[i+1]+b[j],make_pair(i+1,j)));
	}
	while(!q.empty())
		q.pop();
	q.push(make_pair(c[1]+d[1],make_pair(1,1)));
	for(register int cas=1;cas<=k;cas++)
	{
		int i=q.top().second.first,j=q.top().second.second;
		ans[cas]=q.top().first;
		q.pop();
		if(j<len)
			q.push(make_pair(c[i]+d[j+1],make_pair(i,j+1)));
		if(j==1 && i<z)
			q.push(make_pair(c[i+1]+d[j],make_pair(i+1,j)));
	}
	for(register int i=1;i<=k;i++)
		printf("%lld\n",ans[i]);
	return 0;
}

Measured memory_bytes: 384
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]


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

taste = []
for i in range (1,n+1):
    taste.append(l+i-1)

if l < 0:
    if (-1)*l < n:
        print(sum(taste))
    else:
        del taste[-1]
        print(sum(taste))
else:
    #最初だけぬかす
    del taste[0]
    print(sum(taste))



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

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

    map<int, int> count;
    int a;
    for (int i = 0; i < N; i++)
    {
        cin >> a;
        count[a - 1]++;
        count[a]++;
        count[a + 1]++;
    }

    int ans = 0;
    for (auto itr = count.begin(); itr != count.end(); itr++)
    {
        if (itr->second > ans)
        {
            ans = itr->second;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 4736
N, K = map(int, input().split())

H_list = [i for i in map(int, input().split())]

sorted_H_list = sorted(H_list)

if N <= K:
	print("0")
elif K == 0:
	print(sum(sorted_H_list))
else:
	print(sum(sorted_H_list[:-K]))


Measured memory_bytes: 26024
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using Pair = pair<int64_t, int64_t>;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  string s, t;
  cin >> N >> s >> t;
  int64_t overwrap = 0;
  for (int64_t ov = 1; ov <= N; ++ov) {
    if (s.substr(N - ov, ov) == t.substr(0, ov)) {
      overwrap = ov;
    }
  }
  // const int64_t L = static_cast<int64_t>(T.length());
  cout << (N * 2 - overwrap) << endl;
  return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
good = [True] * n
for _ in range(m):
    a, b = map(int, input().split())
    if (h[a - 1] < h[b - 1]):
        good[a - 1] = False
    elif (h[b - 1] < h[a - 1]):
        good[b - 1] = False
    else:
        good[a - 1] = False
        good[b - 1] = False

cnt = 0
for i in range(n):
    if good[i]:
        cnt += 1


print(cnt)


Measured memory_bytes: 20120
import sys
input = sys.stdin.readline
from collections import Counter


N = int(input())
a_list = list(map(int, input().split()))
a_list_unique = list(set(a_list))
a_cnt = Counter(a_list)
cnt = 0
for i in a_list_unique:
    a_dict = a_cnt[i]
    if i <= a_dict:
        cnt +=  a_dict - i
    else:
        cnt += a_dict
print(cnt)

Measured memory_bytes: 20628
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define int long long
#define pb push_back
#define x first
#define y second
#define mk(a,b) make_pair(a,b)
#define rr return 0
#define sqr(a) ((a)*(a))
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()

using namespace std;
using namespace __gnu_cxx;
using namespace __gnu_pbds;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

template<class value, class cmp = less<value> >
using ordered_set = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class value, class cmp = less_equal<value> >
using ordered_multiset = tree<value, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
template<class key, class value, class cmp = less<key> >
using ordered_map = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;

/// find_by_order()
/// order_of_key()
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
inline int randll(int l = INT_MIN, int r = INT_MAX) {
    return uniform_int_distribution<int>(l, r)(rng);
}

const int INF = 1e9, MOD = 998244353; /// think
const ll LINF = 1e15;

const int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
inline bool inside (int x, int y, int n, int m) {
    return 0 <= x && 0 <= y && x < n && y < m;
}

template<class T> bool umin (T &a, T b) {return a > b ? (a = b, true) : false; }
template<class T> bool umax (T &a, T b) {return a < b ? (a = b, true) : false; }

main()
{
    ios::sync_with_stdio(0);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, h, ans = 0;
    cin >> n >> h;
    for (int i = 0, x; i < n; i++) {
        cin >> x;
        if (x >= h) ++ans;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int maxn = 1e5+9;
int a[maxn];

int main() {
    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin.exceptions(cin.failbit);
    int n, ans = 0;
    //cin >> n;
    string days[] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin >> s;
    int pos = 0;
    rep(i,0 , 7){
        if (days[i] == s){
            pos = i;
            break;
        }
    }
    if (s == "SUN"){
        cout << 7 << '\n';
        return 0;
    }
    int i = 0;
    while (days[pos] != "SUN"){
        pos++;
        pos %= 7;
        i++;
    }
    cout << i << '\n';
    //rep(i, 0, n) cin >> a[i];
    //cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
//Coded by tzc_wk
/*
Êý¾Ý²»Çå¿Õ£¬±¬ÁãÁ½ÐÐÀá¡£
¶à²â²»¶ÁÍê£¬±¬ÁãÁ½ÐÐÀá¡£
±ß½ç²»ÌØÅÐ£¬±¬ÁãÁ½ÐÐÀá¡£
Ì°ÐÄ²»Ö¤Ã÷£¬±¬ÁãÁ½ÐÐÀá¡£
D P Ë³Ðò´í£¬±¬ÁãÁ½ÐÐÀá¡£
´óÐ¡ÉÙµÈºÅ£¬±¬ÁãÁ½ÐÐÀá¡£
±äÁ¿²»Í³Ò»£¬±¬ÁãÁ½ÐÐÀá¡£
Ô½½ç²»ÅÐ¶Ï£¬±¬ÁãÁ½ÐÐÀá¡£
µ÷ÊÔ²»×¢ÊÍ£¬±¬ÁãÁ½ÐÐÀá¡£
Òç³ö²» l l£¬±¬ÁãÁ½ÐÐÀá¡£
ÍüÎÄ¼þ²Ù×÷£¬±¬ÁãÁ½ÐÐÀá¡£
*/
#include <bits/stdc++.h>
using namespace std;
#define fi			first
#define se			second
#define fz(i,a,b)	for(int i=a;i<=b;i++)
#define fd(i,a,b)	for(int i=a;i>=b;i--)
#define foreach(it,v) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define all(a)		a.begin(),a.end()
#define giveup(...) return printf(__VA_ARGS__),0;
#define fill0(a)	memset(a,0,sizeof(a))
#define fill1(a)	memset(a,-1,sizeof(a))
#define fillbig(a)	memset(a,0x3f,sizeof(a))
#define fillsmall(a) memset(a,0xcf,sizeof(a))
#define mask(a)		(1ll<<(a))
#define maskx(a,x)	((a)<<(x))
#define _bit(a,x)	(((a)>>(x))&1)
#define _sz(a)		((int)(a).size())
#define filei(a)	freopen(a,"r",stdin);
#define fileo(a)	freopen(a,"w",stdout);
#define fileio(a) 	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define put(x)		putchar(x)
#define eoln        put('\n')
#define space		put(' ')
#define y1			y_chenxiaoyan_1
#define y0			y_chenxiaoyan_0
#define int long long
typedef pair<int,int> pii;
inline int read(){
	int x=0,neg=1;char c=getchar();
	while(!isdigit(c)){
		if(c=='-')	neg=-1;
		c=getchar();
	}
	while(isdigit(c))	x=x*10+c-'0',c=getchar();
	return x*neg;
}
inline void print(int x){
	if(x<0){
		putchar('-');
		print(abs(x));
		return;
	}
	if(x<=9)	putchar(x+'0');
	else{
		print(x/10);
		putchar(x%10+'0');
	}
}
inline int qpow(int x,int e,int _MOD){
	int ans=1;
	while(e){
		if(e&1)	ans=ans*x%_MOD;
		x=x*x%_MOD;
		e>>=1;
	}
	return ans;
}
int n=read(),m=read(),s=read(),c[55],d[55];
struct edge{
	int u,v,w;
	edge(){/*ycxakioi*/}
	edge(int _u,int _v,int _w){
		u=_u;v=_v;w=_w;
	}
};
const int MAGIC=2456;
inline int id(int x,int y){
	return x*(MAGIC+1)+y;
}
vector<edge> g[55*2555];
int dist[55*2555],vis[25*2555];
priority_queue<pii,vector<pii>,greater<pii> > q;
signed main(){
	fz(i,1,m){
		int u,v,a,b;cin>>u>>v>>a>>b;
		fz(j,0,MAGIC){
			if(j>=a){
//				cout<<id(u,j)<<endl;
				g[id(u,j)].push_back(edge(id(u,j),id(v,j-a),b));
				g[id(v,j)].push_back(edge(id(v,j),id(u,j-a),b));
			}
		}
	}
	fz(i,1,n)	c[i]=read(),d[i]=read();
	fz(i,1,n){
		fz(j,0,MAGIC-1){
			int cur=j+c[i];
			if(cur>=MAGIC){
				g[id(i,j)].push_back(edge(id(i,j),id(i,MAGIC),d[i]));
			}
			else{
				g[id(i,j)].push_back(edge(id(i,j),id(i,cur),d[i]));
			}
		}
	}
//	cout<<"g[2458].size()="<<g[2458].size()<<endl;
	fillbig(dist);
	dist[id(1,min(s,MAGIC))]=0;
	q.push({0,id(1,min(s,MAGIC))});
	while(!q.empty()){
		pii p=q.top();q.pop();
		int sum=p.fi,x=p.se;
//		cout<<x<<" "<<dist[x]<<endl;
		if(sum>dist[x])	continue;
//		puts("-1");
		foreach(it,g[x]){
			int y=it->v,z=it->w;
//			cout<<"y="<<y<<" "<<z<<endl;
			if(dist[y]>dist[x]+z){
				dist[y]=dist[x]+z;
				q.push({dist[y],y});
			}
		}
	}
	fz(i,2,n){
		int mn=0x3f3f3f3f3f3f3f3fll;
		fz(j,0,MAGIC)	mn=min(mn,dist[id(i,j)]);
		cout<<mn<<endl;
	}
	return 0;
}

Measured memory_bytes: 30112
a,b = map(int,input().split())
s = input()

if s.count('-') == 1:
    S = s.split('-')
    if len('-'.join(S)) == a+b+1 and len(S[0]) == a and len(S[1]) == b:
        print('Yes')
    else:
        print('No')
else:
    print('No')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;
const ll INF = 1ll << 60;

// O(N^3)
// return value: whether the graph does not have negative loop
bool warshall_floyd(vector<vector<ll>> &adj) {
    int n = adj.size();
    for (int k = 0; k < n; k++) {
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                adj[i][j] = min(adj[i][j], adj[i][k] + adj[k][j]);
            }
        }
    }
    for (int i = 0; i < n; i++) {
        if (adj[i][i] < 0) return false;
    }
    return true;
}

// verified
//   http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_C&lang=jp
void AOJ_GRL_1_C() {
    int V, E;
    cin >> V >> E;
    vector<vector<ll>> adj(V, vector<ll>(V, INF));
    for (int i = 0; i < V; i++) adj[i][i] = 0;
    for (int i = 0; i < E; i++) {
        int s, t; ll d;
        cin >> s >> t >> d;
        adj[s][t] = d;
    }
    bool negative_loop = warshall_floyd(adj);
    if (!negative_loop) {
        cout << "NEGATIVE CYCLE" << '\n';
        return;
    }
    for (int i = 0; i < V; i++) {
        for (int j = 0; j < V; j++) {
            if (j) cout << ' ';
            if (adj[i][j] == INF) cout << "INF";
            else cout << adj[i][j];
        }
        cout << '\n';
    }
}

// not verified
//  https://atcoder.jp/contests/abc073/tasks/abc073_d
#include <algorithm>
void AtCoder_2017_9_9_D() {
    int n, m, R, a, b, c;
    cin >> n >> m >> R;
    vector<int> r(R);
    for (int i = 0; i < R; i++) { cin >> r[i]; r[i]--; }
    sort(r.begin(), r.end());
    vector<vector<ll>> adj(n, vector<ll>(n, INF));
    for (int i = 0; i < n; i++) adj[i][i] = 0;
    for (int i = 0; i < m; i++) {
        cin >> a >> b >> c;
        a--; b--;
        if (c < adj[a][b]) adj[a][b] = adj[b][a] = c;
    }
    warshall_floyd(adj);
    int ans = 0;
    for (int i = 1; i < R; i++) ans += adj[r[i - 1]][r[i]];
    while (next_permutation(r.begin(), r.end())) {
        int tmp = 0;
        for (int i = 1; i < R; i++) tmp += adj[r[i - 1]][r[i]];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}

int main() {
    // AOJ_GRL_1_C();
    AtCoder_2017_9_9_D();
    return 0;
}

Measured memory_bytes: 3896