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

namespace ConsoleApplication1
{
    struct Position
    {
        internal int x, y;

        public Position(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }

    class Program
    {
        static readonly int[] moveX = new int[] { 0, +1, 0, -1 };
        static readonly int[] moveY = new int[] { -1, 0, +1, 0 };

        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            int d = int.Parse(Console.ReadLine());

            bool isStart = true;

            while (d-- > 0)
            {
                if (!isStart) sb.Append("\n");
                else isStart = false;

                int n = int.Parse(Console.ReadLine());

                char[][] map = new char[n][];

                map[0] = Enumerable.Repeat('#', n).ToArray();

                for (int i = 1; i < n; i++)
                {
                    map[i] = Enumerable.Repeat(' ', n).ToArray();
                }

                Position cur = new Position(0, n - 1);
                map[cur.y][cur.x] = '#';

                Position[] target = new Position[4];
                target[0] = new Position(0, 0);
                target[1] = new Position(n - 1, 0);
                target[2] = new Position(n - 1, n - 1);
                target[3] = new Position(2, n - 1);

                bool flg = true;

                while (flg)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        int moveCount = 0;

                        while (!Equal(cur, target[i]))
                        {
                            cur.x += moveX[i];
                            cur.y += moveY[i];
                            moveCount++;

                            map[cur.y][cur.x] = '#';
                        }

                        if (moveCount <= 1)
                        {
                            flg = false;
                            break;
                        }
                    }

                    if (flg)
                    {
                        target[0] = new Position(target[0].x + 2, target[0].y + 2);
                        target[1] = new Position(target[1].x - 2, target[1].y + 2);
                        target[2] = new Position(target[2].x - 2, target[2].y - 2);
                        target[3] = new Position(target[3].x + 2, target[3].y - 2);
                    }
                }

                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        sb.Append(map[i][j]);
                    }
                    sb.Append("\n");
                }
            }
            Console.Write(sb);
        }

        static bool Equal(Position a, Position b)
        {
            if (a.x != b.x) return false;
            if (a.y != b.y) return false;
            return true;
        }
    }
}

Measured memory_bytes: 9456
N = []
while 1:
  x = int(raw_input())
  if x==0: break
  N.append(x)
n0 = max(N)-2
A = [1,1,2]+[0]*n0
for i in range(0, n0): A[i+3] = sum(A[i:i+3])
for e in N: print (A[e]+3649)/3650

Measured memory_bytes: 4208
///
// File:  main.cpp
// Author: ymiyamoto
//
// Created on Fri Feb  1 15:28:02 2019
//
#include <bits/stdc++.h>
using namespace std;

#define rep(_n, _init, _N) for (int32_t _n = _init; _n < (int32_t)(_N); _n++)
#define rrep(_n, _N, _end) for (int32_t _n = (int32_t)(_N); _n >= _end; _n--)
#define iceil(_x, _y) (((_x) + (_y)-1) / (_y))
#define ifloor(_x, _y) ((_x) / (_y))

static const double pi = 2 * asin(1);
static const double precision = 10e-9;

int32_t main()
{
  int64_t n;
  scanf("%ld", &n);

  vector<int64_t> as(n);
  for(int i = 0; i < n;i++){
    scanf("%ld", &as[i]);
  }
  vector<int64_t> bs(n);
  for(int i = 0; i < n;i++){
    scanf("%ld", &bs[i]);
  }

  int64_t ans = 0;
  vector<int64_t> tmp(n);
  for(int i = 0; i < 31;i++){
    int64_t div = 1 << (i+1);
    for(int j = 0; j < n;j++){
      tmp[j] = bs[j] % div;
    }

    sort(tmp.begin(), tmp.end());
    int64_t count  = 0;
    for(int j = 0;j <n;j++){
      int64_t a = as[j] % div;
      auto x = lower_bound(tmp.begin(),tmp.end(), (1<<i)-a);
      auto y = lower_bound(tmp.begin(),tmp.end(), 2*(1<<i)-a);
      auto z = lower_bound(tmp.begin(),tmp.end(), 3*(1<<i)-a);
      auto w = lower_bound(tmp.begin(),tmp.end(), 4*(1<<i)-a);
      count += y - x + w - z;
    }
    if(count %2 == 1){
      ans += 1<<i;
    }
  }
  printf("%ld\n", ans);

  return 0;
}


Measured memory_bytes: 4992
# -*- coding: utf-8 -*-

n=int(input())
a=list(map(int,input().split()))
ans=[0 for _ in range(n)]

for i in range(n):
    ans[a[i]-1]=i+1

for i in range(n-1):
    print(ans[i], end=' ')
print(ans[n-1])

Measured memory_bytes: 14008
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007
#define all(v)  v.begin(),v.end()
#define pb push_back
#define size(v)  (int) v.size()
#define fast ios_base:: sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
ll power_mod(ll a,ll x){if(x==0) return 1;ll y=power_mod(a,x/2);ll ans=(y*y)%mod; if(x%2) ans=(ans*a)%mod;return ans;}
ll inv(ll a){return power_mod(a,mod-2);}    
#define N 100005
int vis[N]={};
vector< int > adj[N];

void dfs(int curr,int &ct,const int &components)
{
	 vis[curr]=components;
	 ct++;
	 for(auto i:adj[curr])
	 {
          if(vis[i]==0)
          {
          	  dfs(i,ct,components);
          }
	 }
}

int main(){
    
    int n,m,k;
    cin>>n>>m>>k;
    int forest[n+1]={};
    int blockship[n+1]={};
    int friend_candi[n+1]={};
    int friendship[n+1]={};
    
    for(int i=0;i<m;i++)
    { 
         int a,b;
         cin>>a>>b;
         friendship[a]++;
         friendship[b]++;
         adj[a].pb(b);
         adj[b].pb(a);
    }
    int components = 0;
    for(int i=1;i<=n;i++){
    	 if(!vis[i])
    	 {
    	 	 int ct = 0;
    	 	 components++;
    	 	 dfs(i,ct,components);
    	 	 forest[components]=ct;
    	 }
    }
    
    for(int i=0;i<k;i++)
    {
    	int c,d;
    	cin>>c>>d;
    	if(vis[c]==vis[d])
    	{
    		blockship[c]++;
    		blockship[d]++;
    	}
    }

    for(int i=1;i<=n;i++)
    {
    	
    	friend_candi[i] = forest[vis[i]]-1-blockship[i]-friendship[i];
    }

    for(int i=1;i<=n;i++) cout<<friend_candi[i]<<" ";
    cout<<endl;

}

Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll gcd(ll a,ll b) {
  if(a%b==0){return b;}
  else{return gcd(b,a%b);}
}
ll lcm(ll a,ll b){
  return a*b/gcd(a,b);
}
int main(){
  ll A,B,C,D;
  cin>>A>>B>>C>>D;
  ll a=A,b=B,divc,divd,divcd;
  if(A%C!=0){A+=C-A%C;}
  if(B%C!=0){B-=B%C;}
  if(A>B){divc=0;}
  else{divc=(B-A)/C+1;}
  A=a;
  B=b;
  if(A%D!=0){A+=D-A%D;}
  if(B%D!=0){B-=B%D;}
  if(A>B){divd=0;}
  else{divd=(B-A)/D+1;}
  A=a;
  B=b;
  while(A%lcm(C,D)!=0){A+=lcm(C,D)-A%lcm(C,D);}
  while(B%lcm(C,D)!=0){B-=B%lcm(C,D);}
  if(A>B){divcd=0;}
  else{divcd=(B-A)/lcm(C,D)+1;}
  cout<<b-a+1-(divc+divd-divcd)<<endl;
}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define ll long long

using namespace std;

int main(){
  int h,w;
  cin>>h>>w;

  rep(i,h){
    string s;
    cin>>s;
    cout<<s<<endl;
    cout<<s<<endl;
  }
  return 0;
}

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

int main()
{
  int W, H, x, y;
  cin >> W >> H >> x >> y;
  int dub = ((double)W / 2 == (double)x && (double)H / 2 == (double)y)? 1 : 0;
  double area = (double)W * H / 2;
  cout << fixed << setprecision(6) << area << " " << dub << endl;
  return 0; 
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std; 
int min(int a,int b)
{
	return a<b? a:b;
}
int main()
{
    int a[100]={0};
    int N;
    scanf("%d",&N);
    int b=0;
    for(int i=0;i<N;i++)
    {
    	int num;
    	scanf("%d",&num);
    	if(num/400<8)
    		a[num/400]++;
    	else
    		b++;
    }
    int c=0;
	for(int i=0;i<8;i++)
		if(a[i]!=0)
			c++;
	int maxx;
	maxx=c+b;
	if(c==0 )
		c=1;
	printf("%d %d\n",c,maxx);
	
    return 0;
 }

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
using i64 = int_fast64_t;
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define all(v) (v).begin(), (v).end()
#define eb emplace_back

int main(){
    int N, R;
    cin >> N >> R;
    if(N >= 10) cout << R << endl;
    else cout << R + 100*(10 - N) << endl;
}


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

#define For(i, j, k) for(int i = j; i <= k; i++)

using namespace std;

const int N = 3010;
const int Mod = 1e9 + 7;

void add(int &x, int y){
	x += y;
	if(x >= Mod) x -= Mod;
}

int dp[N][N];
int n, m;
int L[N], sum[N], R[N];
char S[N];

int main(){
	scanf("%d%d", &n, &m);
	scanf("%s", S + 1);
	For(i, 1, n) sum[i] = sum[i - 1] + (S[i] == '1');
	For(i, 1, m) scanf("%d%d", &L[i], &R[i]);

	dp[0][0] = 1;
	int p = 1, mx = 0;
	For(i, 1, n){
		mx = max(mx, i);
		while(p <= m && L[p] == i){
			mx = max(mx, R[p]);
			++p;
		}

		For(j, 0, i - 1){
			int v = dp[i - 1][j];
			if(!v) continue;
			if(j + 1 <= sum[mx]) add(dp[i][j + 1], v);
			if(i - j <= mx - sum[mx]) add(dp[i][j], v);
		}
	}
	printf("%d\n", dp[n][sum[n]]);
	return 0;
}

Measured memory_bytes: 33920
#include <stdio.h>

int main(void)
{
	int tate, yoko, menseki, syuu;
	scanf("%d", &tate);
	scanf("%d", &yoko);

	if (1 <= tate, yoko && tate, yoko <= 100)
	{
		menseki = tate * yoko;
		syuu = (tate * 2) + (yoko * 2);
		printf("%d %d\n", menseki, syuu);

	};
	return 0;
}


Measured memory_bytes: 2036
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	string s;

	if (d == 25) {
		s = "Christmas";
	}
	else if (d == 24) {
		s = "Christmas Eve";
	}
	else if (d == 23) {
		s = "Christmas Eve Eve";
	}
	else if (d==22) {
		s = "Christmas Eve Eve Eve";
	}

	cout << s << endl;

	return 0;
}

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

//ABC167D
//ABC167C
//ABC167B
//ABC167A
int main(void) {
  int n, k, i, cou=0, tmp;
  char a[100], b[100];
  scanf(" %s %s", a, b);

  for(i=0; a[i]!='\0'; ++i)
    ;
  for(k=0; b[k]!='\0'; ++k)
    ;
  if(k==i+1 && strncmp(a,b,i)==0){
    printf("Yes");
  }else printf("No");
}


Measured memory_bytes: 1744
s = input()
count = 0
if s[0] == 'R' and s[1] == 'R' and s[2] == 'R':
  count = 3
elif s[0] == 'R' and s[1] == 'R' or s[1] == 'R' and s[2] == 'R':
  count = 2
elif 'R' in s:
  count = 1
print(count)

Measured memory_bytes: 9108
#include<iostream>
#include<vector>
#define INT_MAX 999999999
#define ll long long int
using namespace std;
int main()
{
  ll n;
  cin>>n;
  vector<ll> a(n), b(n), c(n);
  for(int i =0; i< n; i++)
    cin>>a[i]>>b[i]>>c[i];
  vector<ll> dp1(n+1, 0), dp2(n+1, 0), dp3(n+1, 0);
  dp1[0] = a[0]; dp2[0] = b[0]; dp3[0] = c[0];
  for(int i = 1; i< n; i++)
  {
    dp1[i] = a[i] + max(dp2[i-1], dp3[i-1]);
    dp2[i] = b[i] + max(dp1[i-1], dp3[i-1]);
    dp3[i] = c[i] + max(dp2[i-1], dp1[i-1]);
  }
  cout<<max(dp1[n-1], max(dp2[n-1], dp3[n-1]))<<endl;
}

Measured memory_bytes: 4992
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc161_a.cpp
 * time   : Sat May  2 21:23:41 2020
 * quest  : A - ABC Swap
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int x, y, z;
  cin >> x >> y >> z;
  cout << z << " " << x << " " << y << "\n";
  return 0;
}


Measured memory_bytes: 256
import bisect
a = int(input())
l = list(map(int,input().split()))
l.sort()
s = 0
for n,x in enumerate(l):
    for m,y in enumerate(l[n+1:]):
        # print(n+m+2)
        t = x + y
        s += bisect.bisect_left(l[n+m+2:],t)


print(s)



Measured memory_bytes: 62692
from collections import defaultdict
N = int(input())

F = [True]*(N+1)
F[0]=F[1]=False
P = []

for i in range(2,N+1):
    if F[i]==True:
        P.append(i)
        for j in range(i*2,N+1,i):
            F[j]=False

dic = defaultdict(int)
for i in range(2,N+1):
    for p in P:
        while i%p==0:
            dic[p] += 1
            i = i//p
        if i==1:
            break

ans = 1
modulo = 10**9+7
for v in dic.values():
    ans *= (v+1)
    ans %= modulo

print(ans)

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


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


int main(){
  int N;
  cin >> N;
  bool flag = false;
  for(int i = 0;i<=N/4;i++){
    for(int j = 0;j<=N/7;j++){
      if(4*i + 7*j == N) flag = true;
    }
  }
  if(flag) cout << "Yes" <<endl;
  else cout << "No" << endl;
}

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

int main(int argc, char *argv[]) {

  int N;
  std::string S;

  int count[26] = {};
  int count2[10] = {};

  std::cin >> N;
  std::cin >> S;
  N = S.size();

  for(int i = 0; i < N; i+=2) {
    count[S[i] - 'a'] += 1;
  }

  for(int i = 0; i < 26; ++i) {
    count2[count[i]] += 1;
  }  

  int res = 0;
  if( count2[1] != 0 ) {
    res += 2 * count2[1] - 1;
  }
  for(int i = 2; i < 10; ++i) {
    if( count2[i] == 0 ) continue;
    if( count2[i] == 1 ) res += 3;
    else res += 2 * count2[i] + 3;
  }

  int notzero = 0;
  for(int i = 1; i < 10; ++i) {
    if( count2[i] != 0 ) notzero += 1;
  }

  res += notzero - 1;

  std::cout << res << std::endl;
  
  return 0;
}

Measured memory_bytes: 3192
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <limits.h>
#include <queue>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

string S[50];
int moji[50][30];

int main(){
    int n;
    cin >> n;
    REP(i,n){
        cin >> S[i];
    }
    REP(i,n){
        REP(k,S[i].length()){
            moji[i][S[i][k] - 'a']++;
        }
    }

    REP(i, 30){
        int cnt = INT_MAX;
        REP(k,n){
            cnt = min(cnt, moji[k][i]);
        }
        REP(t,cnt){
            printf("%c", 'a'+i);
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
//#include <tuple>
#include <map>
#include <cmath>
#include <numeric>
#include <complex>
#include <cassert>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//typedef tuple<int, int, int> T;
typedef pair<ll, ll> Pl;
//typedef tuple<ll, ll, ll> Tl;
double G[21][21];
bool ok[21][21][21];
double dp[21][21][10100];
bool used[21][21][10100] = {};
double r;
int n;


double calc(int b, int i, int nn) {
	assert(b != i);
	if (!nn) return 0;
	if (used[b][i][nn]) return dp[b][i][nn];
	used[b][i][nn] = true;
	double res = 1e10;
	for (int j = 0; j < n; j++) {
		if (i == j) continue;
		if (ok[b][i][j]) {
			res = min(res, calc(i, j, nn-1)+G[i][j]);
		}
	}
	dp[b][i][nn] = res;
	return res;
}

bool solve(int md) {
	for (int i = 1; i < n; i++) {
		if (calc(0, i, md-1)+G[0][i] <= r) return true;
	}
	return false;
}

int main() {
	cin >> n;
	double c;
	cin >> r >> c;
	c = c/180*M_PI;
	complex<double> u[21];
	for (int i = 0; i < n; i++) {
		double a, b;
		cin >> a >> b;
		u[i] = complex<double>(a, b);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			G[i][j] = abs(u[i]-u[j]);
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			for (int k = 0; k < n; k++) {
				double si = abs(arg(u[j]-u[i]) - arg(u[k] - u[j]));
				si = fmod(si+2*M_PI, 2*M_PI);
				si = min(si, 2*M_PI-si);
				if (si < c) {
					ok[i][j][k] = true;
				} else {
					ok[i][j][k] = false;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			ok[i][j][i] = false;
			ok[i][i][j] = false;
			ok[j][i][i] = false;
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			//printf("%d %d %f\n", i, j, G[i][j]);
			for (int k = 0; k < n; k++) {
				//printf("%d %d %d %d\n", i, j, k, ok[i][j][k]);
			}
		}
	}
	int ll = 0, rr = 10100;
	while (rr - ll > 1) {
		int md = (ll+rr)/2;
		if (solve(md)) {
			ll = md;
		} else {
			rr = md;
		}
	}
	cout << ll << endl;
}

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


int main() {
    int n; cin >> n;
    vector<vector<int>> a(n, vector<int>(n-1));
    rep(i, n) {
        rep(j, n-1) {
            cin >> a[i][j];
            a[i][j]--;
        }
        reverse(a[i].begin(), a[i].end());
    }

    vector<pair<int, int>> q;
    auto check = [&](int i) {
        if (a[i].size() == 0) return;
        int j = a[i].back();
        if (a[j].size() == 0) return;
        if (a[j].back() == i) {
            pair<int, int> p(i, j);
            if (p.second < p.first) swap(p.first, p.second);
            q.push_back(p);
        }
    };
    rep(i, n) check(i);

    int ans = 0; 
    while (q.size() > 0) {
        ans++;
        sort(q.begin(), q.end());
        q.erase(unique(q.begin(), q.end()), q.end());
        vector<pair<int, int>> prevQ;
        swap(prevQ, q);
 
        for (pair<int, int> p : prevQ) {
            int i = p.first, j = p.second;
            a[i].pop_back();
            a[j].pop_back();
        }
        for (pair<int, int> p : prevQ) {
            int i = p.first, j = p.second;
            check(i);
            check(j);
        }
    }

    rep(i, n) {
        if (0 != a[i].size()) {
            cout << -1 << endl;
            return 0;
        }
    }

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

Measured memory_bytes: 4224
n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
arr=sorted(arr,key=lambda x:x[1])
arr=sorted(arr,key=lambda x:x[0])
ans=n
for i in range(n):
  for j in range(i+1,n):
    p,q=arr[j][0]-arr[i][0],arr[j][1]-arr[i][1]
    cnt=0
    flag=[0]*n
    for k in range(n):
      if flag[k]==1:
        continue
      flag[k]=1
      a,b=arr[k][0],arr[k][1]
      while 1:
        for l in range(n):
          if flag[l]==1:
            continue
          if a+p==arr[l][0] and b+q==arr[l][1]:
            flag[l]=1
            a=arr[l][0]
            b=arr[l][1]
            break
        else:
          break
      cnt+=1
    ans=min(ans,cnt)
print(ans)

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

int main(){
    int a,b,k;
    cin >> a >> b >> k;
    if(b - a + 1 <= 2 * k){
        for(int i=a; i<=b; i++){
            cout << i << endl;
        }
    }else{
        for(int i=a; i<a+k; i++){
            cout << i << endl;
        }
        for(int i=b-k+1; i<=b; i++){
            cout << i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


N, X = map(int, input().split())
xs = list(map(int, input().split()))

ds = []
for x in xs:
    ds.append(abs(x - X))


ans = ds[0]
for d in ds[1:]:
    ans = gcd(ans, d)


print(ans)


Measured memory_bytes: 14252
n = int(input())
count = {}
for i in range(n):
    s = input()
    if s in count:
        count[s] += 1
    else:
        count[s] = 1

m = int(input())
for i in range(m):
    s = input()
    if s in count:
        count[s] -= 1

print(max(list(count.values())+[0]))

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

int main() {
  int N,N1,N2,N3,N4;
  cin >> N;
  N1 = N/1000;
  N2 = (N-N1*1000)/100;
  N3 = (N-N1*1000-N2*100)/10;
  N4 = N-N1*1000-N2*100-N3*10;
  
  cout << (((N1==N2) && (N2==N3)) || ((N3==N4) && (N2==N3)) ? "Yes" : "No")
    << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repf(i, j, n) for (int i = (j); i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)

signed main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  map<int, int> cnt;
  for (auto&& u : a) cnt[u]++;
  for (auto&& u : b) cnt[u]++;
  for (auto&& u : cnt)
    if (u.second % 2 == 1) cout << "NO" << endl, exit(0);
  cout << "YES" << endl;
}

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


const int N = pow(10,5)+5;
int x[N]={},y[N] = {};

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

    for(int i = 0; i < n/2; ++i){
        int a,b;

        cin >> a >> b;

        x[a]++;
        y[b]++;
    }

    //cout << "a" << endl;

    int xmax = 0,ypos,ymax = 0,xpos,xxmax = 0,yymax = 0,xxpos,yypos;

    for(int i = 0; i < N; ++i){
        if(x[i] > xmax){
            xxmax = xmax;
            xxpos = xpos;
            xmax = x[i];
            xpos = i;
        }else if(x[i] > xxmax){
            xxmax = x[i];
            xxpos = i;
        }

        if(y[i] > ymax){
            yymax = ymax;
            yypos = ypos;
            ymax = y[i];
            ypos = i;
        }else if(y[i] > yymax){
            yymax = y[i];
            yypos = i;
        }
    }

    //cout << xmax << " " << ymax << " " << xxmax << " " << yymax << endl;
    //cout << xpos << " " << ypos << " " << xxpos << " " << yypos << endl;

    if(xpos != ypos){
        cout << n - xmax - ymax << endl;
    }else{
        if(xxmax > yymax){
            cout << n - xxmax - ymax << endl;//cout << "a";
        }else{
            cout << n - xmax - yymax << endl;
        }
    }


}

Measured memory_bytes: 1024
a, b, c = map(int, input().split())

t1 = abs(a//2 * b * c - ((a - a//2) * b * c))
t2 = abs(b//2 * a * c - ((b - b//2) * a * c))
t3 = abs(c//2 * b * a - ((c - c//2) * b * a))
print(min(t1, t2, t3))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
// ll intpoint(ll x1, ll y1, ll x2, ll y2) { return ( __gcd(abs(x1-x2),abs(y1-y2))+1); }
// bool isvalid(ll x,ll y,ll n,ll m) { return (x>=0&&x<n&&y>=0&&y<m); }
// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// int pp = uniform_int_distribution<int>(0, kk-1)(rng);
// ---------------------///////////////---------------------------------
// ---------------------///////////////----------------------------------
// -------------/////////////////---------------------------------///////



int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin>>n;
    ll ap[n+11];
    for(ll i=0;i<n;i++){
        cin>>ap[i];
    }

    long double ans = 0;

    for(ll i=0;i<n;i++){
        ans += (long double)((long double)(1)/(long double)(ap[i]));
    }

    ans = (long double)(1)/(long double)(ans);

    // set
    cout<<setprecision(15)<<ans<<fixed;
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int d2b(int n,int b,char c[])
{
    int i=0,k;                                                                                                                                                   
    while(n!=0)
    {
        k=n%b;
        n/=b;
        if(k<0){k-=b;n+=1;}//这里是负进制的重点
        if(k>9)c[i]=char(k-10+'A');
        else c[i]=char(k+'0');
        i++;
    }
    return i-1;
}
int main()
{
    int a,n,i;
    char b[40];
    scanf("%d",&a),n=-2;
    if(a==0)printf("0");
    for(i=d2b(a,n,b);i>=0;i--)printf("%c",b[i]);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	int d, x;
	cin >> d >> x;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int ans = 0;
	rep(i, n) {
		int tmp = 1;
		int cnt = 0;
		while (tmp <= d) {
			ans++;
			cnt++;
			tmp = cnt * a[i] + 1;
		}
	}
	cout << ans + x << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
int main(){
	int a,b,c;
	std::cin >> a;
	std::cin >> b;
	std::cin >> c;
	if(a < b && b < c)
		std::cout << "Yes" << std::endl;
	else
		std::cout << "No" << std::endl;
	return 0;
}

Measured memory_bytes: 1160
n,m=map(int,input().split())
a=set()
mod=10**9+7
dp=[0]*(n+1)
dp[0]=1
for i in range(m):
    a.add(int(input()))
for i in range(1,n+1):
    if i in a:
        continue
    if i>=1:
        dp[i]+=dp[i-1]
    if i>=2:
        dp[i]+=dp[i-2]
    dp[i]%=mod
print(dp[-1])
# print(dp)

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

vector<int>a;
ll ans = 0;
int length;

int dfs(int i,ll suspend,ll sum){
  if(i==length){
    ans += sum + suspend;
    return 0;
  }
  dfs(i+1,suspend*10+a[i],sum);
  dfs(i+1,a[i],sum+suspend);
  return 0;
}

int main(){
  string s;
  cin >> s;
  length = s.length();
  for(int i=0;i<length;i++){
    a.push_back(s[i] - '0');
  }
  dfs(1,a[0],0);
  cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    k = int(input())
    n = 50
    a = list(range(n))
    for i in range(n):
        a[i] += k // n
    for i in range(k % n):
        a[n - i - 1] += 1
    print(n)
    print(" ".join(str(x) for x in a))

if __name__ == "__main__":
    main()


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

vector<int> F(50, 0);

int fib(int x) {
  if(F[x] != 0) return F[x];
  
  if(x==0 or x==1) F[x] = 1;
  else F[x] = fib(x-1)+fib(x-2);
  
  return F[x];
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  
  int n;
  cin >> n;
  cout << fib(n) << "\n";
}


Measured memory_bytes: 3224
#!/usr/bin/env python3
import sys


def solve(N: int, A: "List[int]"):
    A.sort()
    ret = A[-1] - A[0]
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int N = 105;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

namespace ModCalculator {
	int MOD;
	inline void Inc(int &x, int y) {
		x += y; if (x >= MOD) x -= MOD;
	}
	inline void Dec(int &x, int y) {
		x -= y; if (x < 0) x += MOD;
	}
	inline int Mul(int x, int y) {
		return 1LL * x * y % MOD;
	}
	inline int Mul(int x, int y, int z) {
		return 1LL * x * y % MOD * z % MOD;
	}
}
using namespace ModCalculator;

inline int ksm(int x, int k) {
	int ret = 1;
	while (k) {
		if (k & 1) ret = Mul(ret, x);
		x = Mul(x, x);
		k >>= 1;
	}
	return ret;
}

int n, m, K;
int fac[N], finv[N], pw[N][N * N];
int dp[2][N][N], g[N][N];

void init() {
	read(n); read(m); read(K); read(MOD);
	if (n < m) swap(n, m);
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) {
		fac[i] = Mul(fac[i - 1], i);
	}
	finv[n] = ksm(fac[n], MOD - 2);
	for (int i = n - 1; i >= 0; --i) {
		finv[i] = Mul(finv[i + 1], i + 1);
	}
	for (int i = 0, r = n * m; i <= K; ++i) {
		pw[i][0] = 1;
		for (int j = 1; j <= r; ++j) {
			pw[i][j] = Mul(pw[i][j - 1], i);
		}
	}
}

void solve() {
	int cur = 0, pre = 1;
	dp[0][0][0] = 1;
	for (int i = 1; i <= K; ++i) {
		swap(pre, cur);
		mset(dp[cur], 0);
		for (int t = 0; t <= n; ++t) {
			for (int k = 0; k <= m; ++k) {
				g[t][k] = Mul(finv[t], pw[i][t * (m - k)], pw[K - i + 1][t * k]);
			}
		}
		for (int j = 0; j <= n; ++j) {
			for (int k = 0; k <= m; ++k) {
				for (int t = 0; t <= j; ++t) {
					Inc(dp[cur][j][k], Mul(dp[pre][j - t][k], g[t][k]));
				}
			}
		}
		
		swap(pre, cur);
		mset(dp[cur], 0);
		for (int j = 0; j <= n; ++j) {
			for (int t = 0; t <= m; ++t) {
				g[j][t] = Mul(finv[t], pw[i][t * (n - j)], pw[K - i + 1][t * j]);
			}
		}
		for (int j = 0; j <= n; ++j) {
			for (int k = 0; k <= m; ++k) {
				for (int t = 0; t <= k; ++t) {
					Inc(dp[cur][j][k], Mul(dp[pre][j][k - t], g[j][t]));
				}
			}
		}
		
		swap(pre, cur);
		mset(dp[cur], 0);
		for (int t = 0; t <= n; ++t) {
			for (int k = 0; k <= m; ++k) {
				g[t][k] = Mul(finv[t], pw[i][t * (m - k)], pw[K - i][t * k]);
				if (t & 1) g[t][k] = MOD - g[t][k];
			}
		}
		for (int j = 0; j <= n; ++j) {
			for (int k = 0; k <= m; ++k) {
				for (int t = 0; t <= j; ++t) {
					Inc(dp[cur][j][k], Mul(dp[pre][j - t][k], g[t][k]));
				}
			}
		}
		
		swap(pre, cur);
		mset(dp[cur], 0);
		for (int j = 0; j <= n; ++j) {
			for (int t = 0; t <= m; ++t) {
				g[j][t] = Mul(finv[t], pw[i][t * (n - j)], pw[K - i][t * j]);
				if (t & 1) g[j][t] = MOD - g[j][t];
			}
		}
		for (int j = 0; j <= n; ++j) {
			for (int k = 0; k <= m; ++k) {
				for (int t = 0; t <= k; ++t) {
					Inc(dp[cur][j][k], Mul(dp[pre][j][k - t], g[j][t]));
				}
			}
		}
	}
	printf("%d\n", Mul(dp[pre][n][m], fac[n], fac[m]));
}

int main() {
	init();
	solve();
	return 0;
}


Measured memory_bytes: 4736
package main

import (
	"fmt"
	"sort"
)

func main() {
	var (
		n, k, count int
	)
	fmt.Scan(&n, &k)
	h := make([]int, n+1)
	for i := 0; i < n; i++ {
		fmt.Scan(&h[i])
	}

	sort.Sort(sort.Reverse(sort.IntSlice(h)))
	leng := len(h)
	for soeji := k; soeji < leng; soeji++ {
		count += h[soeji]
	}
	fmt.Println(count)
}


Measured memory_bytes: 5504
#include <bits/stdc++.h>
#define LOG(...) printf(__VA_ARGS__)
using namespace std;

int lookup[100005];

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

    int low = 100001;
    int high = 0;

    for (int i = 0; i < N; ++i) {
        int x;
        cin >> x;
        ++lookup[x];

        if (x < low)
            low = x;
        if (x > high)
            high = x;
    }

    int best = 0;
    for (int i = low; i <= high; ++i) {
        int r = lookup[i] + lookup[i + 1] + lookup[i + 2];
        if (r > best)
            best = r;
    }

    cout << best << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>


using namespace std;

int main()
{
   int a, b, mi, ma;
   cin >> a >> b;
   mi = min(a,b);
   ma = max(a,b);

   string mi_st = to_string(mi);
   string ma_st = to_string(ma);
   string ans;

   for(int i=0; i<ma; i++)
   {
       ans += mi_st;
   }

   cout << ans << endl;

}



Measured memory_bytes: 256
N = int(input())
P = input().split()
if P[0]=="T" and P[1]=="F":
    out = "F"
else:
    out = "T"
for i in range(N-2):
    if out == "T" and P[i+2] == "F":
        out = "F"
    else:
        out = "T"
print(out)


Measured memory_bytes: 6592
n=int(input())
 
ab = []
for _ in range(n):
    a, b, c = (int(x) for x in input().split())
    ab.append([a, b, c])
 
dp = [[0 for i in range(3)] for j in range(n+1)]
 
for i in range(n):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i+1][k] = max([dp[i+1][k], dp[i][j]+ab[i][k]])
 
print(max(dp[n]))

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

using namespace std;
#define rep(i, N) for(int i=0;i<int(N);++i)
#define rep1(i, N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << "{" << p.first << ", " << p.second << "}";
    return os;
}

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;
}

const int INF = (ll) 1e9;
const ll INFLL = (ll) 1e18 + 1;
const ll MOD = (ll) 1e9 + 7;
const double PI = acos(-1.0);

/*
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const string dir = "DRUL";
*/

int N;
vector<string> S;

//s -> t
bool check(int dx, int dy) {
    //写す
    string tmp;
    rep(i,N)tmp.push_back('.');
    vector<string> t(N, tmp);
    rep(i, N)rep(j, N) {
            int nx = (i + dx) % N;
            int ny = (j + dy) % N;
            t[nx][ny] = S[i][j];
        }
    //check
    rep(i, N)rep(j, N) {
            if (t[i][j] != t[j][i]) {
                return false;
            }
        }
    return true;
}

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

    cin >> N;
    S.resize(N);
    rep(i, N)cin >> S[i];
    ll ans = 0;
    //(0,0)でどうなるかが(i,i)と同じ
    if (check(0, 0)){
        ans += N;
    }
    //aのみを1~N-1まで全探索
    //(a,0)が(a+j,j)と同じ
    rep1(a, N) {
        if (check(a, 0)){
            ans += N - a;
        }
    }
    //bのみを1~N-1まで全探索
    //(0,b)が(i,i+b)と同じ
    //N = 4
    //(0,0), (1,1), (2,2), (2,3)
    //(0,1), (1,2), (2,3)
    //(0,2), (2,3)
    //(0,3)
    rep1(b, N) {
        if (check(0, b)){
            ans += N - b;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

class Main {

    public static void main(String args[]){
      Scanner sc = new Scanner(System.in);
      int num = Integer.parseInt(sc.nextLine());
      String values = sc.nextLine();
      String costs = sc.nextLine();

      int result = 0;
      for(int i= 0; i<num; i++){
        int v = Integer.parseInt(values.split(" ")[i]);
        int c = Integer.parseInt(costs.split(" ")[i]);
        if(v>c) result += v-c;
      }
      System.out.println(result);
    }


}

Measured memory_bytes: 21716
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

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

	int min= 30001;

	min= std::min(min, a+b);
	min= std::min(min, b+c);
	min= std::min(min, a+c);

	std::cout<<min<<std::endl;

	return 0;
}

Measured memory_bytes: 256
/*input
0 3
*/
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
using ll = long long;
using ld = long double;
using pii = pair<int,int>;
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
#define sz(x) (int)x.size()
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
const ll INF64=4e18;
const int INF=0x3f3f3f3f;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld eps=1e-6;
#define lowb(x) x&(-x)
#define MNTO(x,y) x=min(x,(__typeof__(x))y)
#define MXTO(x,y) x=max(x,(__typeof__(x))y)
ll sub(ll a,ll b){
    ll x=a-b;
    while(x<0) x+=MOD;
    while(x>MOD) x-=MOD;
    return x;
}
ll mult(ll a,ll b){
    return (a*b)%MOD;
}
ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=(res*a)%MOD;
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
const ll maxn=1e5+5;
const ll maxlg=__lg(maxn)+2; 
int main(){
	int n,m;
	cin>>n>>m;
	cout<<(n*(n-1))/2+(m*(m-1))/2;
	
}


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

int main() {
  int n;
  cin >> n;
  vector<int> l(n);
  rep(i, n) cin >> l[i];
  sort(l.begin(), l.end());

  ll ans = 0;
  for (int a = 0; a < n; ++a) {
    for (int b = a + 1; b < n; ++b) {
      int num_c = lower_bound(l.begin(), l.end(), l[a] + l[b]) - l.begin() - b - 1;
      ans += num_c;
      // printf("l[%d] = %d, l[%d] = %d, num_c = %d\n", a, l[a], b, l[b], num_c);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

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;
}

vector<int> as;

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

    int dist_sum = 0;

    as.resize(N + 2);
    as[0] = 0;
    for (int i = 1; i <= N; i++) {
        cin >> as[i];
        dist_sum += abs(as[i] - as[i - 1]);
    }
    as[N + 1] = 0;
    dist_sum += abs(as[N + 1] - as[N]);

    // printf("dist_sum: %d\n", dist_sum);

    for (int i = 1; i <= N; i++) {
        cout << dist_sum - abs(as[i - 1] - as[i]) - abs(as[i] - as[i + 1]) + abs(as[i - 1] - as[i + 1]) << endl;
    }

    return 0;
}


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

typedef long long lli;
const int MOD=1e9+7,MAXN=1000000;

int n;
int main() {
	scanf("%d",&n);

	int ps=n-1,ans=n,pr=n,ppr=1;
	for(int i=2;i<=n;i++) {
		ans = (pr + ps + 1ll*(n-1)*(n-1)%MOD)%MOD;
		ps = (1ll*ps + ppr - 1 + MOD)%MOD;
		ppr = pr;
		pr = ans;
		pr = ans;
	}
	printf("%d\n",ans);
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <math.h>
#include <iomanip>
#include <vector>
#include <queue>
#include <functional>
#include <random>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
int main() {
	string s;
	cin >> s;
	s[3] = '8';
	cout << s << endl;
	return 0;
}

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

using namespace std;

int main(){
  long long ans = 0;
  int N;
  cin >> N;

  for (int i=1; i<=N; i++){
    if(i%3!=0 && i%5!=0) {
      ans += i;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main(){
	string s;cin>>s;set<char> se;for(char c:s)se.insert(c);
	for(char i='a';i<='z';i++){
		if(!se.count(i)){
			cout<<i;return 0;
		}
	}
	cout<<"None";
}


Measured memory_bytes: 512
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main(){ 
  long long a,b,c=0,d,e;cin>>a>>b;
  vector<bool>q(a,true);
  rep(i,b){
    cin>>d;
    rep(o,d){
      cin>>e;
      q[e-1]=false;
    }
  }
  rep(i,a){
    if(q[i])c++;
  }
  cout<<c;
  }


Measured memory_bytes: 3624
import sys
input = sys.stdin.readline
def main():
    H, W = map(int, input().split())
    A = [list(input().rstrip()) for i in range(H)]
    CNT = 0
    for i in range(H):
        for j in range(W):
            if A[i][j] == '#':
                CNT += 1
    if CNT == H+W-1:
        print('Possible')
    else:
        print('Impossible')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9144
N, K ,Q = list(map(int, input().split()))
Point = [K for n in range(N)]
for q in range(Q):
    A = int(input()) - 1
    Point[A] += 1

for n in range(N):
    if Point[n] - Q > 0:
        print('Yes')
    else:
        print('No')


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

int main() {
    int N, L; cin >> N >> L;
    int taste_array[N], MIN = 300, ans = 0, MIN_i;
    for (int i = 0; i < N; i++) {
        taste_array[i] = L + i;
        if (MIN > abs(taste_array[i])) {
            MIN = abs(taste_array[i]);
            MIN_i = i;
        }
    }
    for (int i = 0; i < N; i++) {
        if (i == MIN_i) {
            continue;
        } else {
            ans += taste_array[i];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
    int n,i,chge,cnt=0;
    cin>>n;
    vector <int> p(n,0);
    for(i=0;i<n;i++) cin>>p[i];
    for(i=0;i<n-1;i++)
    {
        if((p[i]==(i+1))and(p[i+1]==(i+2)))
        {
            chge=p[i];
            p[i]=p[i+1];
            p[i+1]=chge;
            cnt++;
        }
    }
    for(i=0;i<n;i++)
    {
        if(p[i]==(i+1))
        {
            chge=p[i];
            if(i==(n-1))
            {
                p[i]=p[i-1];
                p[i-1]=chge;
            }
            else
            {
                p[i]=p[i+1];
                p[i+1]=chge;
            }
            cnt++;
        }
    }
    cout<<cnt;
    system ("pause"); 
    return 0;
}

Measured memory_bytes: 888
n, w = map(int, input().split())
dp = [0] * (w + 1)
for j in range(n):
	w1, v1 = map(int, input().split())
	i = w
	while i >= 0 and i - w1 >= 0:
		dp[i] = max(dp[i - w1] + v1, dp[i])
		i -= 1
print(max(dp))


Measured memory_bytes: 68860
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.rbegin(), x.rend()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int max(int a,int b,int c)
{
	if(a>b)
	{
		if(a>c)
			return a;
		else
			return c;
	}
	else
	{
		if(b>c)
			return b;
		else
			return c;
	}
} 

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int X,Y,A,B,C;
    cin>>X>>Y>>A>>B>>C;
    vi va,vb,vc;
	int nb;		
    F0R(x,A)
	{
		cin>>nb;
		va.pb(nb);
	}
	F0R(x,B)
	{
		cin>>nb;
		vb.pb(nb);
	}
	F0R(x,C)
	{
		cin>>nb;
		vc.pb(nb);
	}
	sort(all(va));
	sort(all(vb));
	sort(all(vc));
	int sa,sb,sc;
	sa=sb=sc=0;
	int a=X,b=Y;
	int ca=0,cb=0;
	ll ans=0;
	while(true)
	{
		if(ca==a+b)
		{
			break;
		}
		bool fa=sa<va.size() && a>0;
		bool fb=sb<vb.size() && b>0;//?
		bool fc=sc<vc.size();
		if(!fa&&!fb&&!fc)
			break;
		int mx=max(fa?va[sa]:-1,fb?vb[sb]:-1,fc?vc[sc]:-1);
		if(fa && mx==va[sa])
		{
			sa++;
			a--;
		}
		else if(fb && mx==vb[sb])
		{
			sb++;
			b--;
		}
		else if(fc && mx==vc[sc])
		{
			sc++;
			ca++;
			//a--;
		}
		// if(a<0)
		// {
		// 	if(ca>0 && b>0)
		// 	{
		// 		ca--;
		// 		b--;
		// 		a++;
		// 	}
		// }
		
		if(sa==va.size() && sb==vb.size() && sc==vc.size())	
			break;
//		if(a==0 && b==0)	
//			break;
		ans+=mx;
		if(b<=0 &&  a<=0)
		{
			break;
		}
	}
	cout<<ans<<endl;
	return 0;
}
 


Measured memory_bytes: 1784