akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
#include <vector>
#include <string>
#include <iomanip>
#include <bitset>
using namespace std;
#define INF	100000000
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define lb lower_bound
#define ub upper_bound
#define SS stringstream
#define rep(i,n) for(int i = 0; i < n; i++)
#define sz(x) ((int)(x).size())
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).begin(), (x).end(), greater<int>() )
#define clr(a,b) memset((a),(b),sizeof(a))
typedef pair<int, int> P;
typedef long long int ll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<P> Vp;
typedef priority_queue<P, vector<P>, greater<P> > PQ;

int n,m;
int num[100000];
char a;
string str;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	while(getline(cin,str)){
		if(str.size() == 0) break;
		int tmp = 0;
		rep(i,str.size()){
			if(str[i] == ','){
				num[tmp]++;
				break;
			}
			tmp = tmp*10+str[i]-'0';
		}
	}
	rep(i,100000) num[i] *= 10000;
	while(getline(cin,str)){
		int tmp = 0;
		rep(i,str.size()){
			if(str[i] == ','){
				if(num[tmp] >= 10000) num[tmp]++;
				break;
			}
			tmp = tmp*10+str[i]-'0';
		}
	}
	rep(i,100000){
		if(num[i] >= 10000 && num[i]%10000 != 0){
			cout << i << " " << (num[i]/10000)+(num[i]%10000) << endl;
		}
	}
}

Measured memory_bytes: 1568
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <cmath>
#include <set>
#include <stack>
#include <queue>
#include <numeric>
#include <deque>
#include <cstring>
#include <iterator>
#include <map>
#include <cstdlib>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <complex>
#include <bitset>
#include <chrono>
#include <random>
#include <assert.h>
#include <array>

using namespace std;

#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mn(x) *min_element((x).begin(),(x).end())
#define mx(x) *max_element((x).begin(),(x).end())
#define sum(x) accumulate((x).begin(),(x).end(),0ll)
#define eb emplace_back
#define el '\n'
typedef  long long  ll;
typedef  unsigned long long  ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<string> vs;

const ld pi=acos(-1);
const ll inf=(ll)1e9+1;
const int mod=1000000007;
//const int mod=998244353;

ll n,m,k;
const int N=1e6;






int main()
{   ios_base::sync_with_stdio(false);cin.tie(NULL);
    int q,t,u,v,h;
    ll x,a,b,c,d,y,z;
    cin >> n >> m;
    int x1, x2, y1, y2;
    cin >> x1 >> y1;
    cin >> x2 >> y2;
    x1--; x2--; y1--; y2--;
    vector<vector<bool>> vv(n,vb(m));
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
            char c;
            cin >> c;
            if(c=='.'){
                vv[i][j]=true;
            }
        }
    }
    vvi dist(n,vi(m,inf));
    auto bfs = [&](int u, int v){
        deque<array<int,3>> q;
        q.push_front({u,v,0});
        while(!q.empty()){
            auto f=q.front();
            q.pop_front();
            if(dist[f[0]][f[1]]!=inf)continue;
            else dist[f[0]][f[1]]=f[2];
            for(int i=-2; i<3; i++){
                for(int j=-2; j<3; j++){
                    int nx=f[0]+i, ny=f[1]+j;
                    if(nx<0||ny<0||nx>=n||ny>=m||dist[nx][ny]!=inf||!vv[nx][ny])continue;
                    if(abs(nx-f[0])+abs(ny-f[1])>1){
                        q.push_back({nx,ny,f[2]+1});
                    }
                    else{
                        q.push_front({nx,ny,f[2]});
                    }
                }
            }
        }
    };
    bfs(x1,y1);
    if(dist[x2][y2]!=inf){
        cout << dist[x2][y2] << el;
    }
    else{
        cout << -1 << el;
    }
    
    
    return 0;
}



Measured memory_bytes: 8140
n=int(input())
a=list(map(int,input().split()))
aa=set(a)
if len(aa)>3:
    print("No")
    exit()
elif a.count(0)==n:
    print("Yes")
    exit()
elif len(aa)<=1:
    print("No")
    exit()
l=[]
l.append(a[0])
for i in range(1,n):
    if a[i]!=a[0]:
        l.append(a[i])
        break
l.append(l[0]^l[1])

if n==0:
    exit()
else:
    if len(aa)==2:
        if n%3==0:
            if (a.count(l[0])==(n//3)*2 and a.count(l[1])==n//3) or (a.count(l[1])==(n//3)*2 and a.count(l[0])==n//3):
                print("Yes")
            else:
                print("No")
        elif n%3==1:
            if (a.count(l[0])==(n//3)*2+1 and a.count(l[1])==n//3) or (a.count(l[1])==(n//3)*2 and a.count(l[0])==n//3+1):
                print("Yes")
            else:
                print("No")
        elif n%3==2:
            if (a.count(l[0])==(n//3)*2+1 and a.count(l[1])==n//3+1) or (a.count(l[1])==(n//3)*2+1 and a.count(l[0])==n//3+1):
                print("Yes")
            else:
                print("No")


    else:
        if n%3==0:
            if a.count(l[0])==n//3 and a.count(l[1])==n//3 and a.count(l[2])==n//3:
                print("Yes")
            else:
                print("No")
        else:
            print("No")


Measured memory_bytes: 60784
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod =1e+9+7;

int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b==c||a+c==b||b+c==a)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}





























































































Measured memory_bytes: 3592
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <numeric>




typedef long long ll;
#define PI 3.14159265359
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define mp make_pair
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBAC
#include <functional>
/*map<Keyの型, Valueの型> 変数名;
queue<型> 変数名;
priority_queue<型> 変数名;
priority_queue<型, vector<型>, greater<型>> 変数名;*/
//copy(v1.begin(), v1.end(), back_inserter(v2));
using namespace std;

ll gcd(ll a, ll b) {
	ll c;
	if (a < b) {
		c = a; a = b; b = c;
	}
	while (b != 0) {
		c = a % b; a = b; b = c;
	}
	return a;
}

ll lcm(ll a, ll b) {
	ll c;
	c = a * b / gcd(a, b);
	return c;
}

int sort_greater(int m, int n) {
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 0; i < n; i++) {
		cout << a[i];
	}
	return 0;
}

int bubblesort(int a[], int n) {
	int sw = 0;
	bool flag = 1;
	for (int i = 0; flag; i++) {
		flag = 0;
		for (int j = n - 1; j >= i + 1; j--) {
			if (a[j] < a[j - 1]) {
				swap(a[j], a[j - 1]);
				flag = 1;
				sw += 1;
			}
		}
	}
	return sw;
}

int a_z()
{
	for (int i = 0; i <= ('Z' - 'A'); i++) {
		cout << (char)('A' + i);
	}
	return 0;
}

int selecttionsort(int a[], int n) {
	int t, sw = 0, minj;
	for (int i = 0; i < n - 1; i++) {
		minj = i;
		for (int j = 0; j < n - 1; j++) {
			if (a[j] < a[minj]) {
				minj = j;
			}
		}
		t = a[i]; a[i] = a[minj]; a[minj] = t;
		if (i != minj) sw += 1;

	}
	return sw;
}

bool is_prime(int x) {
	if (x <= 1) return false;
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) return false;
	}
	return true;
}

const ll mod = 1000000007;

map<string, int> memo;

using P=pair<int, int>;

/*void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p) continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}*/
ll findIndex(int value, vector<ll> a)
{

	for (ll i = 0; i < (ll)a.size(); i++) {
		if (a[i] == value) {
			return i;
		}
	}
	return -1;
}

ll nCr(ll n, ll r) {
	ll a = 1;
	for (ll i = n; i > n - r; --i) {
		a = a * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		a = a / i;
	}
	return a;
}

void comb(vector<vector <long long int> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (ll j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j]);
		}
	}
}

const int INF = 1001001001;

int main() {
	int r;
	cin >> r;
	if (r < 1200)cout << "ABC";
	else if (r < 2800)cout << "ARC";
	else cout << "AGC";
	return 0;
}













Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
    string S,T; cin>>S>>T;
	int ans=T.size();
	for(int i=0; i+T.size()<=S.size(); i++) {
		int c=0;
		for (int j=0; j<T.size(); j++) c += S[i+j] != T[j];
		if (ans>c) ans=c;
	}
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3572
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;

int main(){
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        if(a<b) std::swap(a, b);
        if(b<c) std::swap(b, c);
        if(a<b) std::swap(a, b);

        int ans = (a-b)/2 + (a-c)/2, f = (a-b)%2 + (a-c)%2;
        if(f==2) ans++;
        else if(f==1) ans += 2;
        printf("%d\n", ans);
        return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
  int n;
  scanf("%d",&n);
  char s[n];
  scanf("%s",s);

  int count = 0;
  int max = 0;
  for(int i = 0;i < n;i ++){
    if(s[i] == '('){
      count --;
    }
    if(s[i] == ')'){
      count ++;
      if(count > max){
        max = count;
      }
    }
  }

  char ans[200];
  for(int i = 0;i < max;i ++){
   printf("(");
  }
  printf("%s",s);
  for(int i = 0;i < max  - count;i ++){
    printf(")");
  }

  return 0;
}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
#define repex(i, a, b, c) for(int i = a; i < b; i += c)
#define repx(i, a, b) repex(i, a, b, 1)
#define rep(i, n) repx(i, 0, n)
#define repr(i, a, b) for(int i = a; i >= b; i--)

int main(){
    
    // 1. 入力情報.
    int L, R, d;
    scanf("%d %d %d", &L, &R, &d);
    
    // 2. d の 倍数 を カウント.
    int ans = 0;
    repx(i, L, R + 1) if(i % d == 0) ans++;
    
    // 3. 出力.
    printf("%d\n", ans);
    return 0;
    
}

Measured memory_bytes: 3708
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

s = p[:X] + q[:Y] + r
s.sort(reverse=True)

print(sum(s[:X+Y]))


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

int main(){
    ll r, d;
    cin >> r >> d;
    vector<ll> x(100);
    cin >> x[0];
    rep(i, 0, 10) x[i+1] = r*x[i] - d;
    rep(i, 1, 11) cout << x[i] << endl;
    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
using namespace std;
typedef long long ll;

int main(){
  int r, d, x;cin>>r>>d>>x;
  for(int i=0;i<10;i++){
    x=r*x-d;
    cout << x << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

const int max_a = 20005;

int main(){
    int N,K; cin >> N >> K;
    int R, S, P; cin >> R >> S >> P;
    //rep(i,3) cin >> RSP[i];
    string T; cin >> T;
    vector<bool> win(N, false);

    ll ans = 0;
    rep(i, T.size()){
        int prev_index = i - K;
        if (prev_index >= 0 && T[i] == T[prev_index] && win[prev_index]) continue;
        if(T[i] == 'r'){
            ans+=P;
        }
        else if(T[i] == 's'){
            ans+=R;
        }
        else{
            ans+=S;
        }
        win[i] = true;
    }    

    cout << ans << endl;
}


Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cstring>
#include <cctype>
#include <complex>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1<<30;
const int EPS = 1e-8;
#define PB push_back
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int > Pii;
int n,s;
int memo[1<<10][1000];
int search(int bit,int dep,int sum){
	if(dep == n && sum == s)return 1;
	if(sum > s)return 0;
	if(memo[bit][sum] != -1)return memo[bit][sum];
	int ans = 0;
	rep(i,10){
		if(!(bit>>i & 1)){
			ans += search(bit|(1<<i),dep+1,sum+i*(dep+1));
		}
	}
	return memo[bit][sum] = ans;
}
int main(){
	while(~scanf("%d%d",&n,&s)){
		memset(memo,-1,sizeof(memo));
		printf("%d\n",search(0,0,0));
	}
	return 0;
}

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

int main(){

  int n,z;
  queue < int > a;

  cin >> n;

  for(int i=0;i<n;i++){
    int x = 0,y = 0;

    for(int j=0;j<10;j++){
      cin >> z;
      a.push(z);
    }

    for(int j=0;j<10;j++){

      if(a.front() > x && a.front() > y){
	if(x < y){
	  y = a.front();
	  a.pop();
	}
	else{
	  x = a.front();
	  a.pop();
	}
      }

      else if(a.front() > x){
	x = a.front();
	a.pop();
      }

      else if(a.front() > y){
	y = a.front();
	a.pop();
      }
    }

    if(a.empty() == true) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
}

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

// template {{{  0 
// using {{{ 1
using ll = long long int;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vii = vector<pii>;
using vll = vector<pll>;
// }}} 1
// definition {{{ 1
// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%lld", &x)
#define Scll2(x,y) scanf("%lld%lld", &x, &y)
#define Scll3(x,y,z) scanf("%lld%lld%lld", &x, &y, &z)
#define Scc(c) scanf("%c", &c);
#define Scs(s) scanf("%s", s);
#define Scstr(s) scanf("%s", &s);
// }}} 2
// constants {{{ 2
#define EPS (1e-7)
#define INF (2e9)
#define PI (acos(-1))
// }}} 2
// systems {{{ 2
#define Repe(x,y,z) for(ll x = z; x < y; x++)
#define Rep(x,y) Repe(x,y,0)
#define RRepe(x,y,z) for(ll x = y-z-1; x >= 0; x--)
#define RRep(x,y) RRepe(x,y,0)
// }}} 2
// output {{{ 2
#define YesNo(a) (a)?printf("Yes\n"):printf("No\n")
#define YESNO(a) (a)?printf("YES\n"):printf("NO\n")
// }}} 2
// }}} 1
// input {{{ 1
// }}} 1
// }}} 0

int main() {

    int N;
    cin >> N;
    string s,t;
    cin >> s;
    cin >> t;
    int ans = N;
    Repe(i,N+1,1){
        if( s.substr(N-i) == t.substr(0,i) ){
            ans = N-i;
        }
    }

    printf ("%d\n", N+ans );

    return 0;
}



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

using namespace std;

void funcA() {

  int x;
  cin >> x;

  if (x >= 30) cout << "Yes";
  else cout << "No";
}

void funcB() {

}

void funcC() {

}

int main() {

  funcA();

  return 0;
}

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

long long N;
int main() {
  cin >> N;
  cout << 50 << endl;
  for (int i = 0; i < 50; i++) {
    if (i) cout << ' ';
    cout << 49 - i + (N + 49 - i) / 50;
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int l[200000] = {0};

int main() {
    int N;
    map<int, int> d;

    scanf("%d", &N);
    for(int i=0;i<N;i++) {
        scanf("%d", &l[i]);
    }

    for(int i=0;i<N;i++) {
        auto itr = d.find(l[i]);
        if(itr != d.end()) {
            d[l[i]]++;
        }
        else {
            d[l[i]] = 1;
        }
    }

    int ans = 0;
    for(auto i=d.rbegin();i!=d.rend();i++) {
        while(i->second > 0) {
            int isFinished = 0;
            for(int j=0;j<32;j++) {
                int v = pow(2, j) - i->first;
                if (i->first < v) {
                    break;
                }
                if (d.find(v)!=d.end()) {
                    if ((v!=i->first && d[v]>=1) || (v==i->first && d[v]>=2)) {
                        i->second--;
                        d[v]--;
                        ans++;
                        isFinished = 1;
                        break;
                    }
                }
            }
            if(isFinished==0) {
                break;
            }
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 12416
// RAM RAM

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define mp make_pair
using namespace std;


set<int> v;
bool hai(int n){
	if(v.find(n)!=v.end()){
		return false;
	}
	return true;
}

bool valid(int n){
	while(n){
		if(!(hai(n%10))){
			return false;
		}
		n/=10;
	}
	return true;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(0);
	
	string res="";
	string a;cin>>a;
	for(int i=0;i<a.length();i++){
		if(a[i]=='0'){
			res.push_back('0');
		}else if(a[i]=='1'){	
			res.push_back('1');
		}else{
			if(res.length()!=0){
				res.pop_back();
			}
		}
	}
	cout<<res<<endl;
}

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

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

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

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}

struct UnionFind{
  ll N;
  llvec p;
  llvec cnt;
  UnionFind(ll n){
    N = n;
    p=llvec(N);
    cnt=llvec(N, 0);
    rep(i, N){
      p[i] = i;
      cnt[i] = 1;
    }
  }

  void con(ll a, ll b){
    P at = root(a);
    P bt = root(b);
    if(at.second!=bt.second){
      if(at.first>bt.first){
        swap(at, bt);
        swap(a, b);
      }
      p[at.second] = bt.second;
      cnt[bt.second]+=cnt[at.second];
      p[a]=bt.second;
    }
  }

  P root(ll a){
    ll atmp = a;
    ll c=0;
    while(atmp!=p[atmp]){
      atmp = p[atmp];
      c++;
    }
    p[a] = atmp;
    return {c, atmp};
  }

  bool is_con(ll a, ll b){
    P at=root(a);
    P bt=root(b);
    return at.second == bt.second;
  }
  
};

struct dijkstra{
  ll N;
  llvec d;
  vector<vector<edge>> e;
  dijkstra(ll n){
    N = n;
    //d = llvec(N, 1e18);
    e = vector<vector<edge>>(N);
  }

  void add_edge(ll from, ll to, ll cost){
    e[from].push_back({to, cost});
  }

  void run(ll start){
    priority_queue<P, vector<P>, greater<P>> que;
    que.push({0, start});
    d = llvec(N, 1e18);
    d[start]=0;
    while(!que.empty()){
      P q = que.top();que.pop();
      ll dc = q.first;
      ll x = q.second;
      if(dc>d[x]){
        continue;
      }else{
        for(auto ip: e[x]){
          if(d[ip.x]<=d[x]+ip.c){
            continue;
          }else{
            d[ip.x]= d[x]+ip.c;
            que.push({d[ip.x], ip.x});
          }
        }
      }
    }
  }  
};


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  ll N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  string S;
  cin >> S;
  bool ok = true;
  FOR(i,A-1, N){
    if(S.substr(i, 2) == "##" and max(C, D)>i){
      ok = false;
    }
  }

  if(C>D){
    ok = false;
    FOR(i,B-2,D-1){
      if(S.substr(i, 3) == "..."){
        ok = true;
      }
    }
  }

  if(ok){
    cout << "Yes"<<endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a[5],b;
    for(int i=0;i<5;i++){
        cin >> b;
        if(b<40){a[i]=40;}
        else a[i]=b;
    }
    int ans=0;
    for(int i=0;i<5;i++){
        ans+=a[i];
    }
    cout << ans/5 << endl;


    return 0;
}


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

int main(){
  string S;
  cin>>S;
  int flag1=0;
  int flag2=0;
  int flag3=1;
  if(S.at(0)=='A'){
    flag1=1;
    S.erase(0,1);
  }
  for(int i=1;i<S.length()-1;i++){
    if(S.at(i)=='C'){
      flag2=1;
      S.erase(i,1);
      break;
    }
  }
  for(int i=0;i<S.length();i++){
    if(isupper(S.at(i))){
      flag3=0;    
    }
  }
  if(flag1*flag2*flag3==1){
    cout<<"AC"<<endl;
    return 0;
    }
  cout<<"WA"<<endl;  
  
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

ll dp[1010][1 << 13];

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

	int N, K;
	cin >> N >> K;
	int cnt = 0;
	for (int i = 0; i < N; i++) {
		int h;
		cin >> h;
		cnt += (h >= K);
	}
	puts(cnt);
	return 0;
}

Measured memory_bytes: 256
import math
while True:
    N = int(input())
    if N == 0:
        break
    list1 = list(map(int, input().split()))
    avg = sum(list1) / N
    total = 0
    for n in range(N):
        total = total + (list1[n] - avg)**2
    S = math.sqrt(total / N)
    print(S)


Measured memory_bytes: 5700
#include <bits/stdc++.h>
 
using namespace std;
 
const int MOD=1e9+7;
 
//const int MOD=998244353;
 
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    
    int a,b, tot=0;
    cin>>a>>b;
    
    while(b--){
        int x;
        cin>>x;
        tot+=x;
    }
    cout<<(tot>=a?"Yes":"No");
    
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
using namespace std;
int main() {
    int n;
    cin >> n;
    int a[n];
    int dp[n];
    dp[0]=0;
    for(int c=0;c<n;c++){
        cin >> a[c];
    }
    for(int i=0;i<n;i++){
        for(int j=i-1;j>=max(i-2,0);j--){
            if(j == i-1)dp[i]=dp[j]+abs(a[j]-a[i]);
            if(j != i-1)dp[i]=min(dp[i],dp[j]+abs(a[j]-a[i]));
        }
    }
    cout<<dp[n-1];
    return 0;
}


Measured memory_bytes: 4356
#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)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

s = input()
t = input()

if sorted(s) < sorted(t, reverse=True):
    print("Yes")
else:
    print("No")





Measured memory_bytes: 9036
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

bool check(const vl& L,const ll& N){
	FOR(i,0,N-1)if(L[i+1] < L[i])return 0;
	return 1;
}

vl Sort(vl L,ll N){
	random_device rnd;
	while(!check(L,N)){
		ll a = rnd()%N;
		ll b = rnd()%N;
		swap(L[a],L[b]);
	}
	return L;
}

signed main(){
	ll N;
	cin >> N;
	vl L(N);
	FOR(i,0,N)cin >> L[i];
	vl ans = Sort(L,N);
	ll SUM = 0;
	FOR(i,0,N)SUM += ans[i];
	Yes(SUM-ans[N-1] > ans[N-1]);
}


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

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
 
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int n,m;
i_i pairs[100001];
 int main() {
    cin >> n >> m;
    for (int i=0;i<m;i++) {
        // secondがa_i, firstがb_i
        cin >> pairs[i].second >> pairs[i].first;
    }
    // b_iでソート
    sort(pairs,pairs+m);
    for (int i=0;i<m;i++) {
    }
    int cnt = 0, cut = 2;
    bool to_cut = true;
    for(int i=0;i<m;i++) {
        if(pairs[i].second >= cut) to_cut = true;
        if(to_cut) {
            cut = pairs[i].first;
            to_cut =false;
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define IOS ios_base::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define PI acos(-1)
#define EPS 1e-5
#define sz(v) ((int)(v).size())
#define all(v) v.begin(),v.end()
#define forn(i, n) for(ll i=0;i<(ll)n;i++)
#define fi first
#define se second
 

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	forn(i, n) cin >> a[i];
	sort(all(a));
	int s = 0;
	for(int i = 0; i < k; i++)
		s += a[i];
	cout << s << endl;
	return 0;

}



Measured memory_bytes: 3612
import sys, math
from operator import itemgetter
from bisect import bisect_left, bisect_right

f_i = sys.stdin

def main():
    n = int(f_i.readline())
    
    lx = []
    ly = []
    li = []
    for i in range(n):
        x, y = map(int, f_i.readline().split())
        lx.append(x)
        ly.append(y)
        li.append(i)

    x_width = max(lx) - min(lx)
    y_width = max(ly) - min(ly)
    if x_width > y_width:
        P = list(zip(lx, ly, li))
    else:
        P = list(zip(ly, lx, li))
    P.sort()

    interval = int(math.sqrt(n))

    low = [v1 for v1, v2, i in P[::interval]]
    high = [v1 for v1, v2, i in P[interval - 1::interval]] + [float('inf')]

    S = []
    v2_sec_list = []
    for i in range(0, n, interval):
        si = P[i:i + interval]
        si.sort(key=itemgetter(1))
        v2_s = [p[1] for p in si]
        v2_sec_list.append(v2_s)
        S.append(si)

    A = []

    q = f_i.readline()

    for l in f_i:
        sx, tx, sy, ty = map(int, l.split())
        a = []
        if x_width > y_width:
            for i in range(bisect_left(high, sx), bisect_right(low, tx)):
                v = S[i]
                k = v2_sec_list[i]
                for j in range(bisect_left(k, sy), bisect_right(k, ty)):
                    if sx <= v[j][0] <= tx:
                        a.append(v[j][2])
        else:
            for i in range(bisect_left(high, sy), bisect_right(low, ty)):
                v = S[i]
                k = v2_sec_list[i]
                for j in range(bisect_left(k, sx), bisect_right(k, tx)):
                    if sy <= v[j][0] <= ty:
                        a.append(v[j][2])
        
        if a:
            a.sort()
            A.extend(a)
        A.append('')

    print('\n'.join(map(str, A)))

main()



Measured memory_bytes: 156916
//ALDS1_5_D_InversionNumber.cpp

#include<bits/stdc++.h>
using namespace std;
const int INF=2E9;
typedef pair<int,int> Pair;
typedef long long LL;



int main(){
    int n;
    cin >> n;
    vector<int> w;
    map<int,int> mp;
    int minV=INF;
    for(int i=0;i<n;i++){
        int tmp;
        cin >> tmp;
        w.push_back(tmp);
        minV=min(minV,tmp);
    }
    vector<int> sw=w;
    sort(sw.begin(),sw.end());
    for(int i=0;i<n;i++){
        mp[sw[i]]=i;
    }
    int *L=new int[n];
    for(int i=0;i<n;i++){
        L[i]=0;
    }
    int MCOST1=0;
    int MCOST2=0;
    int minW=INF;
    int sum=0;
    int totalcost=0;
    int cnt=0;

    for(int i=0;i<n;i++){
        cnt=0;
        minW=INF;
        sum=0;
        if(L[i]!=1){
            if(mp[w[i]]==i) continue;
            int j=i;
            do {
                sum+=w[j];
                minW=min(minW,w[j]);
                cnt++;
                L[j]=1;
                j=mp[w[j]];
            }while(L[j]!=1);
            MCOST1=sum+(cnt-2)*minW;
            MCOST2=sum+minW+(cnt+1)*minV;

            totalcost+=min(MCOST1,MCOST2);
        }
    }
    cout << totalcost << endl;
    return 0;
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;

signed
main(){
		int N;
		cin >> N;
		vector<int> a(N), is_same(N);

		for(int i=0;i<N;i++)
				cin >> a[i];

		for(int l=0;l<=N-1;l++)
		{
				int r = (N - 1) - l;
				is_same[l] = abs(l-r);
		}

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

		bool flag = true;
		for(int i=0;i<N;i++)
		{
				if(a[i]!=is_same[i])
				{
						flag = false;
						break;
				}
		}

		if(!flag)
		{
				cout << 0 << endl;
				return 0;
		}

		//初期化
		int key = is_same[0];
		ll cnt = 1, ans = 1;

		for(int i=1;i<N;i++)
		{
				if(key == is_same[i])
				{
						cnt++;
				}else{
						ans *= cnt;
						ans %= MOD;
						cnt = 1;
				}
				key = is_same[i];
		}
		ans *= cnt;
		ans %= MOD;

		cout << ans << endl;
}

Measured memory_bytes: 1024
from collections import deque
from math import ceil
H, W = [int(i) for i in input().split()]
s = [input() for _ in range(H)]

dq = deque()
D = [[999999999999]*W for _ in range(H)]
if s[0][0] == '.':
    D[0][0] = 0
else:
    D[0][0] = 1
dq.append((0, 0, s[0][0]))

while len(dq):
    h, w, m = dq.popleft()
    d = D[h][w]

    for nh, nw in ((h+1, w), (h, w+1)):
        if nh < H and nw < W:
            if D[nh][nw] == 999999999999:
                dq.append((nh, nw, s[nh][nw]))
            if s[nh][nw] != m:
                D[nh][nw] = min(D[nh][nw], d+1)
            else:
                D[nh][nw] = min(D[nh][nw], d)

print(ceil(D[-1][-1]/2))


Measured memory_bytes: 41200
import java.util.*;
import java.math.BigDecimal;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    int len = s.length();
    System.out.println(s.substring(0, 1) + (len - 2) + s.substring(len - 1));
  }
}

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

#define rep(l, r) for (int i = (l); i < (r); i++)

typedef long long ll;
 
using namespace std;

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    cout << (a <= c && c <= b ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main { 
    public static int gcd(int a, int b){
      return b == 0 ? a:gcd(b,a%b);
    }
  
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        Integer A[] = new Integer[N];
        int ans = 0;
        for (int i=0; i<N; i++){
          A[i] = sc.nextInt();
        }
		int[] L = new int[N+1];
		int[] R = new int[N+1];
		for(int i = 0; i < N; i++)
			L[i+1] = gcd(L[i],A[i]);
		for(int i = N-1; i > 0; i--)
			R[i] = gcd(R[i+1], A[i]);
		for(int i = 0; i < N; i++)
			ans = Math.max(ans, gcd(L[i],R[i+1]));
		System.out.println(ans);  
      }
    
}

Measured memory_bytes: 63216
#include <stdio.h>

int main(){
	int n;
	scanf("%d", &n);
	getchar();
	
	char letter[n+1];
	scanf("%[^\n]", letter);
	
	if(n % 2 == 0){
		int mid = n / 2;
		
		int flag = 0;
		for(int i = 0; i < mid; i++){
			if(letter[i] != letter[i + mid]){
				flag = 1;
				break;
			}
		}
		
		if(flag == 0){
			printf("Yes");
		}
		else{
			printf("No");
		}
	}
	else{
		printf("No");
	}
	
	return 0;
}

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

int main (){
    int64_t a;//aくんの座標
    int64_t v;//aくんの速度
    int64_t b;//bくんの座標
    int64_t w;//bくんの速度
    int64_t t;//何秒間
    cin >> a >> v >> b >> w >> t;
    int64_t kyori;
    if(a < b)kyori = b-a;
    if(a > b)kyori = a-b;
    if(a == b){
        cout << "YES" << endl;
        return 0;
    }
    if(v*t - kyori >= w*t)cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    if (N == M) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

using ll = long long;

constexpr int MAX_N = 2*1e5;
int a[MAX_N];
ll s[MAX_N+1];

int main() {
  int N;
  cin >> N;
  for (int i{}; i < N; ++i)
    cin >> a[i];

  // 累積和
  for (int i{}; i < N; ++i) {
    s[i + 1] = s[i] + a[i];
  }
  map<ll, ll> num;
  for (int i{}; i <= N; ++i) {
    ++num[s[i]];
  }

  ll ans{};
  for (const auto& p : num) {
    if (p.second <= 1) continue;
    ans += p.second * (p.second - 1) / 2;
  }

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


Measured memory_bytes: 15104
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h,w,k;
    cin>>h>>w>>k;
    vs f(h);cin>>f;
    vvl ans(h,vl(w,0));
    set<ll> e;
    rep(i,h){
        bool isExist=false;
        rep(j,w){
            ans[i][j]=k;
            if(f[i][j]=='#'){k--;isExist=true;}
            if(ans[i][j]==0)ans[i][j]=1;
        }
        rrep(j,w)if(f[i][j]=='.'){ans[i][j]=k+1;}else break;
        if(!isExist)e.insert(i);
    }
    ll ind=-1;
    rep(i,h){
        if(e.find(i)!=e.end()){
            if(ind!=-1){
                ans[i]=ans[ind];
                e.erase(i);
            }
        }else ind=i;
    }
    ind=-1;
    rrep(i,h){
        if(e.find(i)!=e.end()){
            if(ind!=-1){
                ans[i]=ans[ind];
                e.erase(i);
            }
        }else ind=i;
    }
    rep(i,h)puta(ans[i]);
    return 0;
}

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

int main()
{   int n,m,a;
    while(~scanf("%d %d %d",&n,&m,&a))
    {
        if(a<=m&&a>=n)
        {
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
    }
    return 0;
}


Measured memory_bytes: 128
import sys
from collections import deque

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def bfs(x, y, c):
    global data
    
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    que = deque()
    que.append(((x, y), c))
    data[y][x] = 'visited'
    black = 1
    white = 0

    while que:
        p, color = que.popleft()
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            next_color = '#' if color == '.' else '.'            
            if 0 <= ny and ny <= H-1 and 0 <= nx and nx <= W-1 and \
                    data[ny][nx] == next_color:
                data[ny][nx] = 'visited'
                if next_color == '.':
                    white += 1
                elif next_color == '#':
                    black += 1
                que.append(((nx, ny), next_color))
    return white * black

H, W = rl()
data = [list(rs()) for _ in range(H)]
answer = 0

for y in range(H):
    for x in range(W):
        if data[y][x] == '#':
            answer += bfs(x, y, data[y][x])

print(answer)
# rest


Measured memory_bytes: 4844
package main

import (
	"fmt"
)

func main() {
	var N int
	fmt.Scan(&N)
	A := make([]int, N+2)
	sum := 0
	for i := 1; i <= N; i++ {
		fmt.Scan(&A[i])
		sum += abs(A[i-1] - A[i])
	}
	sum += abs(A[N] - 0)

	for i := 1; i <= N; i++ {
		l := sum - abs(A[i-1]-A[i]) - abs(A[i]-A[i+1]) + abs(A[i-1]-A[i+1])
		fmt.Println(l)
	}

}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 6528
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		String[] tokens = in.readLine().split(" ");
		long A = Long.parseLong(tokens[0]);
		long B = Long.parseLong(tokens[1]);
		long C = -1L;
		if (Math.abs(A - B) % 2 == 0) {
			if (A < B) {
				C = A + (B - A) / 2;
			} else {
				C = B + (A - B) / 2;
			}
		}
		if (C >= 0) {
			System.out.println(C);
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}
}

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

int  main(){
  int k,n,mx=-1;
  cin>>k>>n;
  vector<int>a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  sort(a.begin(),a.end());
  for(int i=0;i<n-1;i++){
    mx=max(a[i+1]-a[i],mx);
  }
  if(k-a[n-1]+a[0]>=mx){
    mx=k-a[n-1]+a[0];
  }
  cout<<k-mx<<endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	cout << (n >= 30 ? "Yes" : "No") << '\n';
}

Measured memory_bytes: 3648
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    //let n = read::<usize>();
    //let n = read::<u32>();
    //let v = read_vec::<i32>();

    let mut count = 1;
    loop {
        let n = read::<u32>();
        if n == 0 { break; }
        println!("Case {}: {}", count, n);
        count += 1;
    }
}



Measured memory_bytes: 5040
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)

int main() {
	int n,x,t;cin >>n>>x>>t;
	int out = n/x;
	if(n%x!=0) ++out;
	cout << out * t << endl;
  return 0;
}


Measured memory_bytes: 3548
package main

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

func main() {
	// sc.Split(bufio.ScanWords)
	t := make([]bool, 26)
	s := nextMega()
	for i := range s {
		t[s[i]-'a'] = true
	}
	for i := range t {
		if !t[i] {
			puts(string('a' + i))
			break
		}
		if i == len(t)-1 {
			puts("None")
		}
	}
	wt.Flush()
}

var (
	sc  = bufio.NewScanner(os.Stdin)
	rdr = bufio.NewReaderSize(os.Stdin, 1000000)
	wt  = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func nextFloat64s(n int) []float64 {
	slice := make([]float64, n)
	for i := 0; i < n; i++ {
		slice[i] = nextFloat64()
	}
	return slice
}

func nextMega() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, _ := rdr.ReadLine()
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func putf(format string, a ...interface{}) {
	fmt.Fprintf(wt, format, a...)
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
//long long mo = 1e9 + 7;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    ll N;
    string S;
    cin >> N;
    cin >> S;
    map<char, ll> mp;
    rep(i,N){
        mp[S[i]]++;
    }
    ll cnt = 0;
    rep(i,N){
        rep(j,N){
            if(i+j+j >= N) break;
            if(S[i] != S[i+j] && S[i+j] != S[i+j+j] && S[i] != S[i+j+j]){
                cnt++;
            }
        }
    }
    cout << mp['R']*mp['G']*mp['B'] - cnt <<endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define endl '\n'
#define inf 9223372036854775807
#define maxn 3000001
#define mod (ll)(1e9+7)
#define int ll
 
using namespace std;
 
void io(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}

int n,m,ar[maxn];
int par[maxn],sz[maxn];


void make_set(int v) {
    par[v] = v;
    sz[v] = 1;
}

int find_set(int v) {
    if (v == par[v])
        return v;
    return par[v] = find_set(par[v]);
}

void union_sets(int a, int b) {
    a = find_set(a);
    b = find_set(b);
    if (a != b) {
        if (sz[a] < sz[b])
            swap(a, b);
        par[b] = a;
        sz[a] += sz[b];
    }
}


void __solve(){
		cin>>n>>m;
		for(int i=1;i<=n;i++){
			make_set(i);
		}
		while(m--){
			int a,b;cin>>a>>b;
			union_sets(a,b);
		}
		int ans=0;
		for(int i=1;i<=n;i++){
			ans=max(ans,sz[i]);
		}
		cout<<ans<<endl;
		
}


int32_t main(){
io();
IOS;    
			int t=1;
			// cin>>t;
			while(t--){
				__solve();
			}
		
		



        

        


        
    
        
        
                


 
        
 
 
 
        
 
 
 
 
        
        
 
        
        
 
    
    
    
    
 
 
       
 
 
 
 
      
   
 
 
 
 
}

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

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

Measured memory_bytes: 3084
deck = {S:[0]*13,H:[0]*13,C:[0]*13,D:[0]*13}

n = gets.chomp.to_i
for i in 1..n do
  suit,rank = gets.chomp.split(" ")
  suit = suit.to_sym
  rank = rank.to_i
  deck[suit][rank-1] = 1
end

for s in [:S,:H,:C,:D] do
  for r in 1..13 do
    if deck[s][r-1] == 0
      printf("%s %d\n",s,r)
    end
  end
end


Measured memory_bytes: 6880
#include<stdio.h>
int main()
{
    int x;
    scanf("%d ",&x);
    if(x==3)
    {
        printf("YES");
    }
    else if(x==5)
    {
        printf("YES");
    }
    else if(x==7)
    {
        printf("YES");
    }
    else
    {
        printf("NO");
    }
    return 0;
}

Measured memory_bytes: 128