akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Linq;

namespace AtCoder.Abc
{
    class QuestionB
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);

            var n = int.Parse(Console.ReadLine());
            var l = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            int cnt = 0;
            for (int i = 0; i < (n-2); i++)
            {
                for (int j = i+1; j < (n-1); j++)
                {
                    for (int k = j+1; k < n; k++)
                    {
                        if (CanTriangle(l[i], l[j], l[k]))
                        {
                            cnt++;
                        }
                    }
                }
            }
            Console.WriteLine(cnt);

            Console.Out.Flush();
        }
        public static bool CanTriangle(int i, int j, int k)
        {
            if (i == j || i == k || j == k) return false;
            var a = new int[] { i, j, k };
            var b = a.OrderBy(i => i).ToArray();
            return (b[0] + b[1]) > b[2];
        }
    }
}


Measured memory_bytes: 41412
import math
def solve():
    n, d = map(int, input().split())
    x = []
    for i in range(n):
        l = list(map(int, input().split()))
        x.append(l)
    num = 0
    for i in range(n):
        for j in range(i+1, n):
            s = 0.0
            for k in range(d):
                s += (x[i][k] - x[j][k]) ** 2
            if math.sqrt(s).is_integer():
                num += 1
    print(num)

if __name__ == "__main__":
    solve()

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

using namespace std;
template<typename T> void in(T &x) { x = 0; bool neg = false; register T c = getchar(); if (c == '-')neg = true, c = getchar(); while ((c < 48) || (c > 57))c = getchar(); for (; c < 48 || c > 57; c = getchar()); for (; c > 47 && c < 58; c = getchar())x = (x << 3) + (x << 1) + (c & 15); if (neg) x *= -1; }
template<typename T> void out(T n) { bool neg = 0; if (n < 0)n *= -1, neg = 1; char snum[65]; int i = 0; do { snum[i++] = n % 10 + '0'; n /= 10; } while (n); --i; if (neg)putchar('-'); while (i >= 0)putchar(snum[i--]); }
template<typename T> void outln(T n) { bool neg = 0; if (n < 0)n *= -1, neg = 1; char snum[65]; int i = 0; do { snum[i++] = n % 10 + '0'; n /= 10; } while (n); --i; if (neg)putchar('-'); while (i >= 0)putchar(snum[i--]); putchar('\n'); }
#define len(_x) (sizeof((_x)) / sizeof(_x)[0])
//#define fastIO 
#define ll long long
#define itr(_c) for(auto i=_c.begin();i!=_c.end();i++)
#define itrr(_c)for(auto i=_c.begin();i!=_c.end();i++)
#define f1(_x)for (int i = 0; i < _x; ++i)
#define fr(_x)for (int i = _x; i >0; i--)
#define f2(_x,_y)for (int i = _x; i < _y; ++i)
#define fileIO 	freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
typedef vector<int> vi; typedef vector<string> vs; typedef vector<bool> vb; vector<long long>vll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
void fastIO(){ ios_base::sync_with_stdio(false); cin.tie(0); }
int main() {
	fastIO();
	int n,cnt=0; string s, t;
	cin >> n >> s >> t;
	int i = 1;
	for (i=n; i>0; --i)
	{
		if(s.substr(s.size() - i )==t.substr(0,i))break;
		if (i == 1 ) { std::cout << 2 * n; return 0; }
	}
	std::cout << 2*n-i;

}


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

bool judgePrimeNumber( int a )
{
    for( int i = 2; i <= sqrt(a); i++ )
        if( a % i == 0 )
            return false;
    return true;
}

int main()
{
    int n;
    bool pn[10000001];
    for( int i = 2; i < 10000001; i++ )
        pn[i] = true;

    for( int i = 2; i <= sqrt(10000001); i++ )
    {
        if( judgePrimeNumber(i) )
            for( int j = i + i; j < 10000001; j += i )
                pn[j] = false;
    }

    while( cin >> n )
    {
        if( n == 0 )
            break;

        for( int i = n; i >= 13; i-- )
            if( pn[i] && pn[i-2] && pn[i-6] && pn[i-8] )
            {
                cout << i << endl;
                break;
            }
    }
    return 0;
}



Measured memory_bytes: 12780
r,g,b,n=list(map(int,input().split()))
i,j=0,0
R,G=0,0
c=0
while R<=n:
    while G<=n-R:
        if (n-R-G)%b==0:
            c+=1
        G+=g
    G=0
    R+=r

print(c)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
  	cin >> n;
  	double arr[n];
  	for(int i = 0 ; i < n ; i++)
      	cin >> arr[i];
 	sort(arr , arr + n);
  	double ans = arr[0];
  	for(int i = 1 ; i < n ; i++)
      	ans = (ans + arr[i])/2;
  	cout << ans << endl;
 	return 0; 
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include <iomanip>
typedef long long ll;
using namespace std;
//1000000007
int main(){
   int N;cin>>N;
   vector<ll> H(N);
   for(int i=0;i<N;i++){
       cin>>H[i];
   }
   for(int i=N-1;i>=1;i--){
       if(H[i-1]<=H[i])continue;
        if(H[i-1]>H[i]){
            if(H[i-1]-H[i]>=2){
                cout<<"No"<<endl;
                return 0;
            }
            else {
                H[i-1]=H[i];
            }
        }
   }
   cout<<"Yes"<<endl;
}


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

using namespace std;

int main() {
    string s;
    int cnt = 0;
    cin >> s;
    for(int i = 0;i < 3;i++){
        if(s[i] == 'R'){
            cnt++;
        }
    }
    if(cnt < 1){
        cout << "0" << endl;
        return 0;
    }
    if(s[1] == 'S'){
        cout << "1" << endl;
        return 0;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 3592
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	private static Scanner sc;

	public static void main(String[] args) {
		sc = new Scanner(System.in);
		Integer size = sc.nextInt();
		ArrayList<Restaurant> list = new ArrayList<Restaurant>();
		Integer count = 0;

		while (count < size) {
			count += 1;
			String city = sc.next();
			int score = sc.nextInt();
			Restaurant res = new Main().new Restaurant(city, score ,count);
			list.add(res);
		}

		Comparator<Restaurant> comparator =
				  Comparator.comparing(Restaurant::getCity).thenComparing(Comparator.comparing(Restaurant::getScore).reversed());

		list.stream().sorted(comparator).forEach(a -> System.out.println(a.getId()));

	}

	public class Restaurant {
		private int id;
		private String city;
		private int score;

		Restaurant(String city, int score, int id){
			this.id = id;
			this.city = city;
			this.score = score;
		}

		public int getId() {return id;}
		public String getCity() { return city;}
		public int getScore() {return score;}
	}

}

Measured memory_bytes: 27732
import sys
import copy
import string
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

x = ni()
ans = x // 11
r = x % 11
ans *= 2
if r == 5 or r > 6:
    ans += 2
elif r > 0:
    ans += 1
print(ans)







Measured memory_bytes: 3900
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl
#define debug cout << "hi" << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int INF32 = 1<<30;
const ll INF64 = 1LL<<60;

int main()
{
	#ifndef ONLINE_JUDGE
	freopen(".in.txt", "r", stdin);
	freopen(".out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	string s; cin >> s;
	cout << (s.back() == 's' ? s + "es" : s + 's');

	return 0;
}

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

int main() {
  int a, b;
  cin>>a>>b;
  if (a == 1 && b == 1) {
    cout<<"1 2"<<endl;
    cout<<"#."<<endl;
    return 0;
  }
  int m[61][100];
  for (int i=1; i<30; i+=3) {
    for (int j=1; j<99; j+=3) {
      for (int k=-1; k<2; k++) {
        for (int l=-1; l<2; l++) {
          m[i+k][j+l] = 1;
        }
      }
      if (a > 1) {
        m[i-1][j-1] = 0;
        --a;
      }
      if (a > 1) {
        m[i][j] = 0;
        --a;
      }
    }
  }
  for (int i=0; i<99; i++) {
    m[31][i] = 0;
  }
  for (int i=32; i<61; i+=3) {
    for (int j=1; j<99; j+=3) {
      for (int k=-1; k<2; k++) {
        for (int l=-1; l<2; l++) {
          m[i+k][j+l] = 0;
        }
      }
      if (b > 1) {
        m[i-1][j-1] = 1;
        --b;
      }
      if (b > 1) {
        m[i][j] = 1;
        --b;
      }
    }
  }
  cout<<"61 99"<<endl;
  for (int i=0; i<61; i++) {
    for (int j=0; j<99; j++) {
      if (m[i][j] == 1) {
        cout<<"#";
      } else {
        cout<<".";
      }
    }
    cout<<endl;
  }
}

Measured memory_bytes: 256
//url:
//problem name:

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
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;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S; cin >> S;
    int N = S.size();
    string S1 = "";
    string S2 = "";
    if(N == 1) {
        S1 = "0";
        S2 = "1";
    } else if(N == 2) {
        S1 = "01";
        S2 = "10";
    } else if(N == 3) {
        S1 = "010";
        S2 = "101";
    } else {
        if(N%2 == 0) {
            for(int i = 0; i < N-2; i++) {
                S1 += "01";
                S2 += "10";
            }
        } else {
            for(int i = 0; i < N-3; i++) {
                S1 += "01";
                S2 += "10";
            }
            S1 += "0";
            S2 += "1";
        }
    }
    //cout << S1 << " " << S2 << endl;

    int ans1 = 0;
    int ans2 = 0;

    for(int i = 0; i < N; i++) {
        if(S[i] != S1[i]) ans1++;
        if(S[i] != S2[i]) ans2++;
    }

    cout << min(ans1,ans2) << endl;
}

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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b,i) do { cout << "["; for (int (i) = (a);(i) < (b);++(i)) cout << ary[(i)] << ((b)-1 == (i) ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

double dp[310][310][310];

double rec(int n,int a,int b,int c) {
    if (dp[a][b][c] > -0.5) return dp[a][b][c];
    dp[a][b][c] = n;
    if (a) dp[a][b][c] += rec(n,a-1,b,c)*a;
    if (b) dp[a][b][c] += rec(n,a+1,b-1,c)*b;
    if (c) dp[a][b][c] += rec(n,a,b+1,c-1)*c;
    dp[a][b][c] /= a+b+c;
    return dp[a][b][c];
}

int main() {
    int n,a[3] = {0,0,0};
    cin >> n;
    for (int i = 0;i < n+1;++i) for (int j = 0;j < n+1;++j) for (int k = 0;k < n+1;++k) dp[i][j][k] = -1;
    dp[0][0][0] = 0;
    for (int i = 0;i < n;++i) {
        int b;
        cin >> b;
        a[b-1]++;
    }
    cout << fixed <<setprecision(12) << rec(n,a[0],a[1],a[2]) << endl;
    return 0;
}

Measured memory_bytes: 227584
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();

int a[11];
void nextone(int N, int M, int a[]);

int main() {
    int N,M,Q;
    cin >> N>>M>>Q;
    REP(i,N+1) a[i+1]=1;
    ll point=0,ans=0;;
    int numbers[Q][4];
    REP(i,Q) cin>>numbers[i][0]>>numbers[i][1]>>numbers[i][2]>>numbers[i][3];
    while(a[0]!=M){
        point=0;
        REP(i,Q){
            if(a[numbers[i][1]]-a[numbers[i][0]]==numbers[i][2]) point+=numbers[i][3];
        }
        nextone(N, M, a);
        ans = max(ans, point);
    }
    cout << ans << endl;
    return 0;
}

void nextone(int N, int M, int a[]){
    if(a[N]!=M){
        a[N]++;
    }else {
        nextone(N-1,M,a);
        a[N]=a[N-1];
    }
}


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

int main() {
  int N,k,c=0;
  cin>>N;
  vector<int> d(N);
  
  for(int i=0;i<N;i++){
    cin>>d.at(i);
    k=0;
    for(int j=0;j<i;j++){
      if(d.at(j)==d.at(i))k++;
    }
    if(k==0)c++;
  }
  cout<<c<<endl;
}

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

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  int asum = 0, bsum = 0;
  for (int i = 0; i < n; ++i) {
    if ((i & 1) == 0)
      asum += a[i];
    else
      bsum += a[i];
  }
  cout << asum - bsum << endl;
  return 0;
}

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

#define Fast cin.tie(0), ios::sync_with_stdio(0)
#define All(x) x.begin(), x.end()
#define louisfghbvc int t; cin >> t; while(t--)
#define sz(x) (int)(x).size()
using namespace std;
typedef long long LL;
typedef pair<LL, LL> ii;
typedef vector<LL> vi;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep = ""; for(const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << "\n"; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

const int N = 405;
LL arr[N];
LL pre[N];
LL dp[N][N][5];


LL dfs(int l, int r, int pile){
    //dbg_out(l, r);
    if(l == r) return pile == 1 ? 0 : 1e14;
    if(dp[l][r][pile] != -1) return dp[l][r][pile];
    LL res = 1e14;
    if(pile == 1){
        res = dfs(l, r, 2) + pre[r+1] - pre[l];
    }
    else{
        for(int k = l; k < r; ++k){
            res = min(res, dfs(l, k, 1) + dfs(k+1, r, 1));
        }
    }
    return dp[l][r][pile] = res;
}

void solve(){
    int n;
    cin >> n;
    for(int i = 0; i < n; ++i) cin >> arr[i];
    pre[0] = 0;
    for(int i = 0; i < n; ++i) pre[i+1] += pre[i] + arr[i];

    memset(dp, -1, sizeof dp);
    cout << dfs(0, n-1, 1) << "\n";
}

int main()
{
    Fast;
    //louisfghbvc{
        solve();
    //}
    return 0;
}


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

#define ll long long
#define pb push_back
//#define f first
//#define s second
#define mp make_pair
#define fi(i, a, b) for (int i = a; i < b; i++)
#define watch(x) cout << (#x) << " is " << x << endl;

using namespace std;

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

    int ans = (a * 3 + b) / 2;
    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define pob pop_back
#define pii pair<int,int>
#define ll long long int
#define sf(a) scanf("%d", &a)
#define forn(n) for(int i = 0; i < n; ++i)
#define form(m) for(int j = 0; j < m; ++j)
const int mx = 1e6+5;
const int inf = 0x3f3f3f3f;
 
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	sf(n), sf(m);
	if(n == m) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long A = sc.nextLong();
        long B = sc.nextLong();
        long C = sc.nextLong();
        long D = sc.nextLong();

        long count = B/C - A/C;
        if (A % C == 0) {
            count++;
        }
        count += B/D - A/D;
        long lcm = lcm(C, D);
        count -= (B / lcm) - (A / lcm);

        System.out.println(B - A + 1 - count);
    }

    private static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }

    private static long gcd(long a, long b) {
        if (a < b) {
            return gcd(b, a);
        }
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }
}



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

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

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

int main(void){

    int n;
    cin >> n;
    vector<P> se(n);
    roop(i, n){
        int a, b;
        cin >> a >> b;
        se[i].first = a+b;
        se[i].second = a-b;
    }

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

    int ans = 0, v = -1000000001;
    roop(i, n){
        if(v <= se[i].second){
            ans++;
            v = se[i].first;
        }
    }


    cout << ans << endl;

    return 0;
}

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

//#define int long long
typedef long long ll;
//const int INF = 2e9;
//const ll INF = 9e18;


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<pair<int,int>> P(N);
    for (int i=0;i<N;i++) {
        int p;
        cin >> p;
        P[i] = make_pair(p, i);
    }
    sort(P.begin(),P.end());
    int mx = 1;
    int s = 1;
    for (int i=1;i<N;i++){
        if (P[i-1].second < P[i].second) mx++;
        else {
            s = max(s, mx);
            mx = 1;
        }
        if (i==N-1) {
            s = max(s,mx);
        }
    }
    cout << N - s << "\n";
}

Measured memory_bytes: 4772
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include<stack>
#include <queue>
#include <set>
using namespace std;
#define int long long
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,m,n) for(ll i=m;i<n;i++)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793
#define INF 1000000007
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2)*pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int jo(int n) {
	int ans = 1;
	rep(i, n) {
		ans *= 2;
	}
	return ans;
}
int n,m,a[105],b[105],dp[105][100010];
signed main() {
	cin >> n >> m;
	rep(i,n){
		cin >> a[i]>>b[i];
	}
	for (ll i = 0; i <= n; i++) {
		dp[0][i] = 0;
	}
	rep(i, n) {
		loop(w, 0, m + 1) {
			if (w >=a[i]) {
				dp[i + 1][w] = max(dp[i][w - a[i]] + b[i], dp[i][w]);
			}
			else dp[i + 1][w] = dp[i][w];
		}
	}
	cout << dp[n][m] << endl;
}

Measured memory_bytes: 79360
import java.util.Scanner;

public class Main {

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int n = sc.nextInt();
        int x = 0;
        int y = 0;
        int t = 0;
        String res = "Yes";
        for(int i=0; i<n ;i++) {
            int ti = sc.nextInt();
            int xi = sc.nextInt();
            int yi = sc.nextInt();

            int d = Math.abs(xi - x) + Math.abs(yi - y);
            int dt = ti - t;
            if(d > dt || (d % 2) != (dt % 2)) {
                res = "No";
                break;
            }
            t = ti;
            x = xi;
            y = yi;
        }
        System.out.println(res);
    }

}


Measured memory_bytes: 87332
using System;

namespace atcoderA
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] line = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int X = line[0];
            int A = line[1];
            int B = line[2];
            if (A >= B)
            {
                Console.WriteLine("delicious");
            }
            else if ((A + X) >= B)
            {
                Console.WriteLine("safe");
            }
            else
            {
                Console.WriteLine("dangerous");
            }
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir[8] = {
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};

signed main() {
	int n, k;
	scanf("%d %d", &n, &k);
	vector<ll> asmsum(n + 2),assum(n+2);
	ll sum = 0;
	REP(i, n) {
		ll a;
		scanf("%lld", &a);
		if (a > 0) {
			sum += a;
			assum[i + 1] += a;
		}
		else {
			asmsum[i + 1] += a;
		}
		assum[i + 2] = assum[i + 1];
		asmsum[i + 2] = asmsum[i + 1];
	}
	ll ans = LLONG_MAX;
	REP(i, n - k + 1) {
		ans = min(ans, assum[i + k] - assum[i]);
		ans = min(ans, abs(asmsum[i + k] - asmsum[i]));
	}
	printf("%lld\n", sum - ans);
	return 0;
}

Measured memory_bytes: 1792
N,T=map(int,input().split())
Time=list(map(int,input().split()))

interval=[]
for i in range(N-1):
    if Time[i+1]-Time[i]>T:
        interval.append(Time[i+1]-Time[i])

k=len(interval)
print(Time[-1]+T-(sum(interval)-k*T))

Measured memory_bytes: 26836
#include <bits/stdc++.h>
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#define invrep(i,n) for(int64_t i=n-1;i >= 0;i--)
#define _GLIBCXX_DEBUG
using namespace std;

int main(){
  int64_t n,m;
  cin >> n >> m;
  vector<int64_t> a(n);
  int64_t total = 0;
  rep(i,n){
    cin >> a[i];
    total += a[i];
  }
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  if(a[m-1]*4*m >= total){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <utility>
#include <climits>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define ll long long
const int MOD = 1000000007;//10^9+7
const string SPACE = " ";

ll powsur(ll a, ll b, ll p) {

	if (b == 0) {

		return 1;

	}
	else if (b % 2 == 0) {

		ll d = powsur(a, b / 2, p);
		return ((d%p)*(d%p)) % p;

	}
	else {

		return ((a%p)*powsur(a, b - 1, p) % p) % p;

	}

}
//pは素数,aのb乗をpで割った余り

ll CMOD(ll n, ll r, ll p) {

	ll a = 1, b = 1, c = 1, re;
	for (int i = 1; i <= n; i++) {

		a *= i;
		a = a%p;

	}
	for (int i = 1; i <= r; i++) {

		b *= i;
		b = b%p;

	}
	for (int i = 1; i <= n - r; i++) {

		c *= i;
		c = c%p;

	}
	b = powsur(b, p - 2, p);
	c = powsur(c, p - 2, p);
	re = ((a%p)*(b%p)) % p;
	re = ((re%p)*c%p) % p;

	return re;

}
//pは素数,(nCr)%p

ll gcd(ll a, ll b) {

	if (a > b) {

		ll tmp = a;
		a = b;
		b = tmp;

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

}
//最大公約数

ll lcm(ll a, ll b) {

	return (a / gcd(a, b))*b;

}
//最小公倍数

int main() {

	string S[3];
	cin >> S[0] >> S[1] >> S[2];
	cout << S[0][0] << S[1][1] << S[2][2] << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string N;
    cin >> N;
    if( N.at(0) == '7'){
        cout << "Yes" << endl;
    }
    else if( N.at(1) =='7'){
        cout << "Yes" << endl;
    }
    else if( N.at(2) =='7'){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

}

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

int main(){
  int n,W;
  cin>>n>>W;
  int w[n],v[n];
  for(int i=0;i<n;i++)
    cin>>w[i]>>v[i];
  int dp[n+1][100001];
  for(int i=0;i<=n;i++)
  {
  	for(int j=0;j<=100000;j++)
   	  dp[i][j]=1000000001;
  }
  dp[0][0]=0;
  for(int i=1;i<=n;i++)
  {
    dp[i][0]=0;
    for(int j=1;j<=100000;j++)
    {
      if(j-v[i-1]<0)
        dp[i][j]=dp[i-1][j];
      else 
        dp[i][j]=min(dp[i-1][j],w[i-1]+dp[i-1][j-v[i-1]]);
    }
  }
  for(int j=100000;j>=0;j--)
  {
    if(dp[n][j]<=W)
    {
      cout<<j<<endl;
      break;
    }
  }
}

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

int main(){
  int H,W;
  cin >> H >> W;
  vector<string> S(H);
  for(int i = 0; i < H; ++i){
    cin >> S.at(i);
  }
  for(int i = -1; i < H + 1; ++i){
    if(i >= 0 && i < H){
      cout << '#' << S.at(i) << '#' << flush;
    }
    else{
      for(int j = 0; j < W + 2; ++j){
        cout << '#' << flush;
      }
    }
    cout << endl;
  }
}


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

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

  int ans = 0, ans_num;
  for(int i = n; i > 0; i--) {
    int cnt = 1;
    int j = i;
    while(j%2 == 0) {
      // cout << "j(before): " << j << endl;
      j /= 2;
      // cout << "j: " << j << endl;
      cnt++;
    }
    if(ans < cnt) {
      ans = cnt;
      ans_num = i;
    }
  }
  cout << ans_num << endl;
}


Measured memory_bytes: 256
N = int(input())
D = [tuple(map(int, input().split())) for _ in range(N)]

def doublet(i):
    return D[i][0] == D[i][1]

def tripledoublet():
    for i in range(N-2):
        if doublet(i) and doublet(i+1) and doublet(i+2):
            return 'Yes'
    else:
        return 'No'

print(tripledoublet())


Measured memory_bytes: 9156
/*
* @Author: wxyww
* @Date: 2020-03-19 08:57:18
* @Last Modified time: 2020-03-19 10:05:44
*/
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<bitset>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1 << 21;
ll read() {
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9') {
		if(c=='-') f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
int *f[N],trans[N][2];
char s[N];
int main() {
	int n = read(),K = read();
	f[1] = new int[1 << (n + 1)];
	f[1][0] = 0;
	for(int i = 0;i <= n;++i) {
		int p = 1 << i;
		scanf("%s",s);
		for(int j = 0;j < p;++j) f[1][p + j] = s[j] - '0';
		for(int j = 0;j < p;++j) trans[p + j][1] = j;
		trans[p + p - 1][0] = 0;
		for(int j = 1;j < p;++j) trans[p + p - j - 1][0] = j ^ ((1 << (31 - __builtin_clz(j))) - 1);
	}
	
	// puts("!!!");

	int ans = 1;
	for(int i = 1;i <= n;++i) {
		int p = 1 << i;
		for(int j = p + p - 1;j >= p;--j) {
			f[j] = new int[1 << (n - i + 1)];
			memset(f[j],0,sizeof(int) << (n - i + 1));
			for(int k = 1;k < (1 << (n - i + 2));++k) f[j][trans[k][j & 1]] += f[j >> 1][k];
			f[j][0] = 0;
			if(accumulate(f[j],f[j] + (1 << (n - i + 1)),0) >= K) ans = j;
		}
	}
	// puts("!!!");
	for(int i = 30 - __builtin_clz(ans);i >= 0;--i) printf("%d",ans >> i & 1);

	return 0;
}

Measured memory_bytes: 247552
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::{i32, i64, u32, u64, usize, f64};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{VecDeque, HashMap, BTreeMap, HashSet, BTreeSet};
#[allow(unused_imports)]
use std::io::{stdout, Write, BufWriter};
#[allow(unused_imports)]
use std::mem::{swap};

fn main() {
    input!{
        n: usize,
        a: [i64; n],
    }
    let out = stdout();
    let mut out = BufWriter::new(out.lock());
    let mut counter = HashMap::new();
    for &x in &a {
        let count = counter.entry(x).or_insert(0);
        *count += 1;
    }
    let s: i64 = counter.values().map(|c| c * (c - 1) / 2).sum();
    for x in a {
        writeln!(out, "{}", s - counter[&x] + 1).unwrap();
    }
}


Measured memory_bytes: 20632
#include<map>
#include<string>
#include<iostream>

using namespace std;

int main()
{
	map<string,int> mp;
	string s;
	while(cin>>s){
		if(mp.count(s)==0)	mp.insert(make_pair(s,1));
		else				mp.find(s)->second++;
	}
	int fmax=0,lmax=0;
	string sfmax,slmax;
	map<string,int>::iterator it;
	for(it=mp.begin();it!=mp.end();it++){
		if(fmax<it->second)			sfmax=it->first,fmax=it->second;
		if(lmax<it->first.length())	slmax=it->first,lmax=it->first.length();
	}
	cout<<sfmax<<" "<<slmax<<endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	string a,b;
	cin>>a>>b;
	if(a.size()>b.size()){
		cout<<"GREATER"<<endl;
		return 0;
	}
	else if(a.size()<b.size()){
		cout<<"LESS"<<endl;
		return 0;
	}
	for(int i=0;i<a.size();i++){
		if(a[i]>b[i]){
			cout<<"GREATER"<<endl;
			return 0;
		}
		else if(a[i]<b[i]){
			cout<<"LESS"<<endl;
			return 0;
		}
	}
	cout<<"EQUAL"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, s, n) for (int i = (s); i < (n); i++)
#define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define ALL(a) a.begin(), a.end()
#define IN(a, x, b) (a <= x && x < b)
const long long MOD = 1e9+7, INF = 1e18;
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;}
//auto f = [&](int n)->int{return n;};
//auto a = [&](auto&&b){b(b)};



signed main(){
	int N,D;
	cin>>N>>D;
	cout<<(N+D*2)/(D*2+1)<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#define NMAX 100003
using namespace std;
int AP[NMAX],x,Max,N,i;
int main()
{
    cin>>N;
    for(i=1;i<=N;i++)
    {
        cin>>x;
        AP[x]++;
        if(x==0) AP[NMAX-1]++;
        else AP[x-1]++;
        AP[x+1]++;
    }
    for(i=1;i<=NMAX-1;i++) if(AP[i]>Max) Max=AP[i];
    cout<<Max;
    return 0;
}


Measured memory_bytes: 640
/*
このコード、と～おれ!
Be accepted!
  ∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define printyn(a) printf(a ? "Yes\n" : "No\n");
#define printYN(a) printf(a ? "YES\n" : "NO\n");
#define all(x) (x).begin(), (x).end()

using ll = long long;

//マクロとかここまで

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
//#include <vector>

using namespace std;

int main() {

	int x = 0, n, xmax = 0;
	char s[100];
	scanf("%d%s", &n, s);
	rep(i, n) {
		if (s[i] == 'I')++x;
		else --x;
		xmax = max(x, xmax);
	}
	printf("%d\n", xmax);
	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main()
{
          int a,p,i=0;
          scanf("%d",&a);
          p=a%10;
          if(p==3)
                    printf("bon\n");
          else if(p==0||p==1||p==6||p==8)
                    printf("pon\n");
                    else
                              printf("hon\n");
}


Measured memory_bytes: 1648
# n = gets.split.map(&:to_i)
# array = readlines.map(&:chomp!).map { |e| e.split.map(&:to_i) }
#
#

s = gets.chomp.reverse
t = ""


u1 = "dreamer".reverse
u2 = "eraser".reverse
u3 = "dream".reverse
u4 = "erase".reverse
while s.slice!(u2)

end
while s.slice!(u4)
end

while s.slice!(u1)
end
while s.slice!(u3)

end

puts s.length == 0 ? "YES" : "NO" 


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

int main() {
	int n, k, a, b, cen, ans, m;

	cin >> n >> k;


	for (int i = 0; i < k; i++) {
		cin >> a >> b;
		a = min(a, n - a + 1);
		b = min(b, n - b + 1);
		ans = min(a, b);
		if (ans % 3 == 0)ans = 3;
		else ans = ans % 3;
		cout << ans << endl;

	}

	return 0;
}


Measured memory_bytes: 3088
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 200005;
const int mod = 1000000007;

int a[maxn];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  cin>>n;
  unordered_map<int,int>mp;
  for(int i=0;i<n;i++){
    cin>>a[i];
    mp[a[i]]++;
  }
  int ret = 0;
  for(int i=0;i<n;i++){
    if(mp[a[i]]>1)continue;
    if(a[i]==1){
      ret++;
      continue;
    }
    if(mp.find(1)!=mp.end()){
      continue;
    }
    bool sign =0;
    for(int j=2;j*j<=a[i];j++){
      if(a[i]%j==0){
        if(mp.find(j)!=mp.end()){
          sign=1;
          break;
        }
        if(mp.find(a[i]/j)!=mp.end()){
          sign=1;
          break;
        }
      }
    }
    if(!sign)ret++;
  }
  cout<<ret<<endl;
  return 0;
}

Measured memory_bytes: 12224
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N;
  cin>>N;
  int sqrtN=(int)sqrt(N);
  int ans=10;
  int Ftmp;
  for (int i=1;i<sqrtN+2;i++){
    if (N%i==0){
      Ftmp=max((int)log10(i)+1,(int)log10(N/i)+1);
      if (Ftmp<ans){
        ans=Ftmp;
      }
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 512
using namespace std; 
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define vect vector<ll>
#define maap map<ll,ll>  
#define MOD 1000000007
#define mit map::iterator
#define pii pair<ll,ll>
#define rep(i,a,b)	for(ll i=a;i< b;i++)
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
typedef  long long   int  ll;
//stringstream convert; 
  //  convert << number; 
  //  string s = convert.str();
 ll fact[500005],invfact[500005]; 
 ll power(ll x, ll y)
{
	ll z = 1;
	while(y > 0)
	{
		if(y % 2 == 1)
			z = (z*x)%MOD;
		x = (x*x)%MOD;
		y /= 2;
	}
	return z;
}
 ll inv(ll x)
{
	return power(x,MOD-2);
}
ll divide(ll x, ll y)
{
	return (x*inv(y))%MOD;
}
ll C(ll n, ll k)
{
	if(k > n) return 0;
	return divide(fact[n], (fact[n - k]*fact[k])%MOD);
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
bool isPrime(int n) {
 
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
} 
void init(){
	ll p=MOD;
	fact[0]=1;
	ll i;
	for(i=1;i<500005;i++){
		fact[i]=(i*fact[i-1])%p;
	}
	i--;
	invfact[i]=power(fact[i],p-2);
	for(i--;i>=0;i--){
		invfact[i]=(invfact[i+1]*(i+1))%p;
	}
}
ll s;
ll fun(ll a)
{
	if(a==0)
	return 0;
	return a+fun(a-1);
}
priority_queue < pair<ll,ll> , vector<pair<ll,ll> >,greater<pair<ll,ll> > > gq;

#define MAXN   10000001 
ll spf[MAXN]; 
void sieve() 
{ 
    spf[1] = 1; 
    for (ll i=2; i<MAXN; i++) 
        spf[i] = i; 
    for (ll i=4; i<MAXN; i+=2) 
        spf[i] = 2; 
    for (ll i=3; i*i<MAXN; i++) 
    {
        if (spf[i] == i) 
        { 
            for (ll j=i*i; j<MAXN; j+=i) 
                if (spf[j]==j) 
                    spf[j] = i; 
        } 
    } 
} 
set<ll> getFactorization(ll x) 
{ 
    set<ll> ret; 
    while (x != 1) 
    { 
        ret.insert(spf[x]); 
        x = x / spf[x]; 
    } 
    return ret; 
} 
void ghost()
{   
  	ll i=0,j=0,k=0,l=0,n,r=-10000000000,q=0,x,y=100000000000,m;
    cin>>n;
    map<string,ll>mp;
    string s;
    for(i=0;i<n;i++)
    {
    	cin>>s;
    	mp[s]++;
	}
	cout<<"AC"" " "x" " "<<mp["AC"]<<endl;
	cout<<"WA"" " "x" " "<<mp["WA"]<<endl;
	cout<<"TLE"" " "x" " "<<mp["TLE"]<<endl;
	cout<<"RE"" " "x" " "<<mp["RE"]<<endl;
  	}
signed main()
{int test=1;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
fast
//cin>>test;
while(test--)
ghost();
return 0;
}

  

Measured memory_bytes: 3656
package main
import "fmt"

func main(){
	var a, b int

	fmt.Scanf("%d %d", &a, &b)

	amaru := (a + b) % 2
	if(amaru == 0) {
		fmt.Println((a+b)/2)
	} else {
		fmt.Println((a+b)/2+1)
	}
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
string s;
int main ()
{
	cin>>s;
	int flag1=0,flag2=0;
	for(int i=0;i<=s.size()-1;++i)
	{
		if(s[i]=='C') flag1=1;
		if(s[i]=='F' && flag1) flag2=1;
	}
	if(flag2) puts("Yes");
	else puts("No");
	return 0;	
} 

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())

int a[200000];

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

	int n, x;
	cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
	}
	else if(n==2){
		if(x==2){
			cout << "Yes" << endl;
			cout << "1\n2\n3\n";
		}else{
			cout << "No" << endl; 
		}
	}
	else {
		memset(a, -1, sizeof(a));
		cout << "Yes" << endl;
		if (x!=2) {
			a[n - 2] = 1;
			a[n - 1] = x;
			a[n] = x + 1;
			a[n + 1] = 2;
			int idx = 0;
			for (int i = 3; i <= 2 * n - 1;i++) {
				if (i != x && i != x + 1) {
					while (a[idx] != -1)idx++;
					a[idx++] = i;
				}
			}
			rep(i, 2 * n - 1)cout << a[i] << endl;
		}
		else {
			a[n - 2] = 2 * n - 1;
			a[n - 1] = 2;
			a[n] = 1;
			a[n + 1] = 2*n-2;
			int idx = 0;
			for (int i = 3; i <= 2 * n - 3; i++) {
				while (a[idx] != -1)idx++;
				a[idx++] = i;
			}
			rep(i, 2 * n - 1)cout << a[i] << endl;
		}
	}


	return 0;
}

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


int main(){
    
    int n;
    int *t,*x,*y;


    bool isPossible = true;

    scanf("%d", &n);
    t = new int[n];
    x = new int[n];
    y = new int[n];

    for(int i = 0; i < n;i++){
        scanf("%d", &t[i]);
        scanf("%d", &x[i]);
        scanf("%d", &y[i]);
    }

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

        if(x[i]+y[i] > t[i] || (x[i]+y[i]+t[i])%2 != 0){
            isPossible = false;
            printf("No");
            break;
        }

    }
    if(isPossible){
        printf("Yes");
    }
    return 0;
}

Measured memory_bytes: 1408
n, m = map(int, input().split())
energy = []
for _ in range(n):
    a, b = map(int, input().split())
    energy.append([a, b])

energy = sorted(energy, key=lambda x: x[0])

ans = 0
for ab in energy:
    a, b = ab
    if m > b:
        m -= b
        ans += a * b
    else:
        ans += a * m
        break
print(ans)

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

using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int a[200000];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;cin>>n;
    REP(i,n)cin>>a[i];
    int b=0;REP(i,n)b^=a[i];
    string ans="";
    REP(i,n){cout<<(a[i]^b)<<"\n";}
    return 0;
}

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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	string N;
	cin >> N;
	rep(i,1,3){
		if (N[i] != N[i-1]){
			cout << "Yes\n";
			return 0;
		}
	}
	cout << "No\n";
}

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;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
//#include <regex>

/* g++ -g -std=c++0x */
/* g++ -g -std=c++11 */

using namespace std;

// freopen("input.txt", "rt", stdin);
// freopen("output.txt", "wt", stdout);

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

int main()
{
/* #ifndef ONLINE_JUDGE */
/*     freopen("foo", "rt", stdin); */
/* #endif */
    std::ios::sync_with_stdio(false);

    char S[4];
    int ans = 0;
    FOR(i,0,4)
        cin >> S[i];
    FOR(i,0,4){
        if (S[i] == '+')
            ans++;
        else
            ans--;
    }
    cout << ans << endl;
}

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

int A[100005], B[100005];

bool func(int val, int N, int M, int V, int P)
{
    int indx = 0;

    for(int i=N; i>=1; i--)
    {
        B[i] = A[i];

        if(B[i] == val)
            indx = i;
    }

    long long rem = 1LL * M * V;

    for(int i=indx; i<=N; i++)
        B[i] += M, rem -= M;
    
    // cout << val << ": ";

    // for(int i=1; i<=N; i++)
    //     cout << B[i] << " ";
    // cout << "\n";
    
    int ptr = 1;

    while(ptr < indx && B[ptr] > B[indx])
        P--, B[ptr++] += M, rem -= M;
    
    // for(int i=1; i<=N; i++)
    //     cout << B[i] << " ";
    // cout << "\n";

    if(P < 0)
        return false;
    
    long long best_ans = 0;
    
    for(int i = ptr; i < indx; i++)
        best_ans += min(B[indx] - B[i], M);
    
    // cout << "Test : " << best_ans << " " << indx << " " << ptr << " " << rem << " " << P << "\n";

    for(int i = ptr; i < indx; i++)
    {
        if(best_ans < rem)
        {
            best_ans -= min(B[indx] - B[i], M);
            P--, B[i] += M, rem -= M;

            if(P < 0)
                return false;
        }
        else
            return true;
    }

    return true;
}

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

    int N, M, V, P;
    cin >> N >> M >> V >> P;

    for(int i=1; i<=N; i++)
        cin >> A[i];
    
    sort(A+1, A+1+N);
    reverse(A+1, A+1+N);

    int left = P, right = N, ans = P;

    while(left <= right)
    {
        int mid = (left + right) / 2;

        if(func(A[mid], N, M, V, P-1))
            ans = mid, left = mid + 1;
        else
            right = mid - 1;
    }

    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 1024
A= int(input())
l=[[0]*10 for _ in range(10)]
for i in range(1,A+1):
   n=str(i)
   if n[0] == "0" or n[-1] == "0":
      continue
   l[int(n[0])][int(n[-1])]+=1
ans=0
for i in range(1,10):
   for j in range(1,10):
      ans+=l[i][j] * l[j][i]
print(ans)

Measured memory_bytes: 3064
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	// write your code here
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a[] = new int[n];
        Arrays.setAll(a, i -> scanner.nextInt());
        int left[] = new int[n], right[] = new int[n];

        for (int i = 1; i < n; i ++) left[i] = gcd(left[i - 1], a[i - 1]);
        for (int i = n - 2; i >= 0; i --) right[i] = gcd(right[i + 1], a[i + 1]);

        int res = 1;
        for (int i = 0; i < n; i ++) res = Math.max(res, gcd(left[i], right[i]));

        System.out.println(res);

    }

    static int gcd(int a, int b) {
        if (a < b) {
            int temp = b;
            b = a;
            a = temp;
        }
        if (b == 0) return a;
        return gcd(a % b, b);
    }
}


Measured memory_bytes: 50564
#include<bits/stdc++.h> 
using namespace std;
int main(){
	int n;
	
	while (scanf("%d",&n)!=EOF)
	{
		int four=0,two=0,one=0;
		int a[n];
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
			if(a[i]%4==0) four++;
			else if(a[i]%2==0) two++;
			else one++;
		}
		if(one>four+1||(one==four+1&&two!=0))  printf("No\n");
		else  printf("Yes\n");
	}
	return 0;
}

Measured memory_bytes: 640