criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
const int MOD=1e9+7;
typedef long long ll;
int q;
int H,W,K;
ll dp[105][10];
//bool accros[105][10];
int main(int argc,char const* argv[])
{
  memset(dp,0,sizeof(dp));
  dp[0][0]=1;
  cin >> H >> W >> K;
  for(int i=0;i<H;i++)
    {
      for(int j=0;j<W;j++)
	{
	  if(dp[i][j]==0) continue;
	  for(int bit=0;bit<(1<<(W-1)); bit++)//横線の置き方は2^(W-1)通り
	    {
	      //横線が隣り合うパターンも含め全列挙
	      bool ok=true;
	      for(int i=0;i<W-2;i++)
		{
		  if((bit >> i & 1) and (bit >> (i+1) & 1)) ok=false;
		  //横線が隣り合うパターンは無視される
		}
	      if(ok)//横線が隣合わないパターンだけ確認
		{
		  //cerr << "bit = " << bitset<10>(bit).to_string() << endl;
		  if(j>0 and (bit >> (j-1) & 1))
		    {
		      dp[i+1][j-1]=(dp[i+1][j-1]+dp[i][j])%MOD;
		    }
		  else if(bit >> j & 1)
		    {
		      dp[i+1][j+1]=(dp[i+1][j+1]+dp[i][j])%MOD;
		    }
		  else
		    {
		      dp[i+1][j]=(dp[i+1][j]+dp[i][j])%MOD;
		    }
		}
	    }
	}
    }
  cout << dp[H][K-1] << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:16:3: error: 'memset' was not declared in this scope
   16 |   memset(dp,0,sizeof(dp));
      |   ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    6 | #include <limits.h>
  +++ |+#include <cstring>
    7 | using namespace std;
Language: C++

import sys
mod = pow(10, 9) + 7
def mul(a, b):
    return ((a % mod) * (b % mod)) % mod

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

NNN = (10**2)
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range( 2, NNN + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )


def erabu(aW):
    r = 0
    for i in range(aW // 2 + 1 + 1):
        sp = aW - (2*i -1)
        r += cmb(sp+i+1-1, sp, mod)
    return r

N, W, K = [int(x) for x in input().strip().split(" ")]
hasi = 0
cc = []
if W == 1:
    if K == 1:
        print(1)
    else:
        print(0)
    sys.exit()
elif W == 2:
    cccl = [1, 1]
    cc = [1, 1]
elif W == 3:
    cccl = [1, 1, 1]
    cc = [2, 1, 2]
elif W >= 4:
    aW = W - 1
    hW = aW - 2
    nhW = aW - 3
    cc = []
    cccl = []
    for w in range(W):
        nn = max(W - 1 - w - 1, 0)
        nnn = max((W - 1) - nn - 2, 0)
        if w == W -1:
            nnn += 1
        cc.append(erabu(nn) * erabu(nnn))
        cccl.append(erabu(nn) * erabu(nnn-1))

cccl[0] = 0
cccr = cccl[::-1]
d = [[1] + [0 for x in range(W-1)]] + [[0] * W for _ in range(N)]
for i in range(N):
    i += 1
    for j in range(W):
        d[i][j] = (d[i-1][j] * cc[j]) % mod
        if j != 0:
            d[i][j] = (d[i][j] + (d[i-1][j-1] * cccl[j]) )% mod
        if j != W-1:
            d[i][j] = (d[i][j] + (d[i-1][j+1] * cccr[j])) % mod

print(d[N][K-1])


Compiler output:
a.cc:1:1: error: 'import' does not name a type
    1 | import sys
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include <bits/stdc++.H>

using namespace std;

int mod = 1000000007;
int dp[110][10];

int main() {
  int H, W, K;
  cin >> H >> W >> K;
  if (W == 1) {
    cout << 1 << endl;
    return 0;
  }
  dp[0][1] = 1;
  for (int i = 0; i < H; i++)
  for (int j = 0; j < (1 << (W - 1)); j++) {
    if (j & (j >> 1)) {
      continue;
    }
    for (int k = 1; k <= W; k++) {
      if (j & (1 << (k - 1))) {
        dp[i + 1][k + 1] += dp[i][k] % mod;
        dp[i + 1][k] += dp[i][k + 1] % mod;
        k++;
      } else {
        dp[i + 1][k] += dp[i][k] % mod;
      }
    }
  }
  cout << dp[H][K] % mod << endl;
  return 0;
}


Compiler output:
a.cc:1:10: fatal error: bits/stdc++.H: No such file or directory
    1 | #include <bits/stdc++.H>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>	
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
using namespace std;
int dx[5]={1,0,-1,0,0},dy[5]={0,1,0,-1,0};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define INF 2000000000
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define mk make_pair
#define en endl
#define RE return 0
#define int ll
#define P pair<int,int>

int h,w,k;

int saiki(int takasa,int yoko){
	if(takasa==h){
		return yoko==k-1;
	}
	
	int cnt=0;
	for(int bit=0; bit<1<<(w-1); bit++){
		bool ok=true;
		for(int k=0; k<w-2; k++){
			if(bit&(1<<k)&&bit&(1<<(k+1))){
				ok=false;
				break;
			}
		}
		if(!ok) continue;
		if(yoko>=1&&bit&(1<<(yoko-1))) cnt+=saiki(takasa+1, yoko-1);
		else if(bit&(1<<(yoko))) cnt+=saiki(takasa+1, yoko+1);
		else cnt+=saiki(takasa+1, yoko);
	}
	return cnt%MOD;
}

signed main(){
	cin>>h>>w>>k;
	memset(dp, -1, sizeof(dp));
	cout<<saiki(0, 0)<<en;
}
	
	

Compiler output:
a.cc: In function 'int main()':
a.cc:64:16: error: 'dp' was not declared in this scope; did you mean 'dy'?
   64 |         memset(dp, -1, sizeof(dp));
      |                ^~
      |                dy
Language: C++

#include <iostream>
#include <cmath>
using namespace std;
int H, W, K, M[101], flg[101], meta[8] = {1,1,2,3,5,8,13,21};

long Calc(void) {
	long result = 1;
	for(int i=1; i<=H; i++)
		result *= meta[M[i] - 1] * meta[W - M[i] - flg[i]];
	return result % 1000000007;
}

long Map(int X, int Y, long result) {
	if (Y == H)
		if (X == K+1) {
			M[Y] = X - 1;
			flg[Y] = 1;
			return Calc();
		} else if (X == K) {
			M[Y] = X;
			flg[Y] = 0;
			return Calc();
		} else if ( X == K-1 ) {
			M[Y] = X;
			flg[Y] = 1;
			return Calc();
		} else 
			return 0;

	if (abs(X-K) > abs(H-Y+1)) return 0;

	M[Y] = X;
	flg[Y] = 0;
	long result = Map(X, Y+1);

	if (X > 1) {
		M[Y] = X-1;
		flg[Y] = 1;
		result += Map(X-1, Y+1);
	}

	if (X < W) {
		M[Y] = X;
		flg[Y] = 1;
		result += Map(X+1, Y+1);
	}

	return result % 1000000007;
}

int main(void) {
/*	while(true) {
		cin >> H >> W >> K;
		if (H < 0) return 0;
		cout << Map(1, 1) << endl;
	}
*/
	cin >> H >> W >> K;
	cout << Map(1, 1, 1);

}


Compiler output:
a.cc: In function 'long int Map(int, int, long int)':
a.cc:34:14: error: declaration of 'long int result' shadows a parameter
   34 |         long result = Map(X, Y+1);
      |              ^~~~~~
a.cc:13:29: note: 'long int result' previously declared here
   13 | long Map(int X, int Y, long result) {
      |                        ~~~~~^~~~~~
a.cc:34:26: error: too few arguments to function 'long int Map(int, int, long int)'
   34 |         long result = Map(X, Y+1);
      |                       ~~~^~~~~~~~
a.cc:13:6: note: declared here
   13 | long Map(int X, int Y, long result) {
      |      ^~~
a.cc:39:30: error: too few arguments to function 'long int Map(int, int, long int)'
   39 |                 result += Map(X-1, Y+1);
      |                           ~~~^~~~~~~~~~
a.cc:13:6: note: declared here
   13 | long Map(int X, int Y, long result) {
      |      ^~~
a.cc:45:30: error: too few arguments to function 'long int Map(int, int, long int)'
   45 |                 result += Map(X+1, Y+1);
      |                           ~~~^~~~~~~~~~
a.cc:13:6: note: declared here
   13 | long Map(int X, int Y, long result) {
      |      ^~~
Language: C++

#include <iostream>
using namespace std;
int H, W, K, M[101], flg[101];

long Calc(void) {
	int meta[8] = {1,1,2,3,5,8,13,21};
	long result = 1;
	for(int i=0; i<H; i++)
		result *= meta[M[i] - 1] * meta[W - M[i] - flg[i]];
	return result % 1000000007;
}

long Map(int X, int Y) {
	if (Y == H)
		switch(X) {
			case K + 1:
				M[Y] = X - 1;
				flg[Y] = 1;
				return Calc();
			case K:
				M[Y] = X;
				flg[Y] = 0;
				return Calc();
			case K - 1:
				M[Y] = X;
				flg[Y] = 1;
				return Calc();
			default:
				return 0;
		}

	M[Y] = X
	flg[Y] = 0;
	long result = Map(X, Y+1);

	if (X > 1) {
		M[Y] = X-1;
		flg[Y] = 1;
		result += Map(X-1, Y+1);
	}

	if (X < W) {
		M[Y] = X;
		flg[Y] = 1;
		result += Map(X+1, Y+1);
	}

	return result % 1000000007;
}

int Main(void) {
	while(true) {
		cin >> H >> W >> K;
		if (H < 0) return 0;
		cout << Map(1, 1);
	}
}

Compiler output:
a.cc: In function 'long int Map(int, int)':
a.cc:16:30: error: the value of 'K' is not usable in a constant expression
   16 |                         case K + 1:
      |                              ^
a.cc:3:11: note: 'int K' is not const
    3 | int H, W, K, M[101], flg[101];
      |           ^
a.cc:16:30: error: the value of 'K' is not usable in a constant expression
   16 |                         case K + 1:
      |                              ^
a.cc:3:11: note: 'int K' is not const
    3 | int H, W, K, M[101], flg[101];
      |           ^
a.cc:20:30: error: the value of 'K' is not usable in a constant expression
   20 |                         case K:
      |                              ^
a.cc:3:11: note: 'int K' is not const
    3 | int H, W, K, M[101], flg[101];
      |           ^
a.cc:20:30: error: the value of 'K' is not usable in a constant expression
   20 |                         case K:
      |                              ^
a.cc:3:11: note: 'int K' is not const
    3 | int H, W, K, M[101], flg[101];
      |           ^
a.cc:24:30: error: the value of 'K' is not usable in a constant expression
   24 |                         case K - 1:
      |                              ^
a.cc:3:11: note: 'int K' is not const
    3 | int H, W, K, M[101], flg[101];
      |           ^
a.cc:24:30: error: the value of 'K' is not usable in a constant expression
   24 |                         case K - 1:
      |                              ^
a.cc:3:11: note: 'int K' is not const
    3 | int H, W, K, M[101], flg[101];
      |           ^
a.cc:32:17: error: expected ';' before 'flg'
   32 |         M[Y] = X
      |                 ^
      |                 ;
   33 |         flg[Y] = 0;
      |         ~~~
Language: C++

include<bits/stdc++.h>
#define md 1000000007
using namespace std;

int main(){
    int h, w, k;
    long long dp[105][10], a[10][3], pr[10];
    scanf("%d%d%d", &h, &w, &k);
    fill(dp[0], dp[105], 0);
    dp[0][1] = 1;
    pr[0] = 1;
    for(int i = 1; i <= w; i++){
        pr[i] = 0;
        for(int j = 0; (j-1)*2 < i; j++){
            long long l = 1;
            for(int m = 1; m <= j; m++) l = l*(i-j+2-m)/m;
            pr[i] = (pr[i] + l) % md;
        }
    }
    for(int i = 1; i <= w; i++){
        a[i][0] = (i-3 >= 0 ? pr[i-3] : 1)*(w-i-1 >= 0 ? pr[w-i-1] : 1)%md;
        a[i][2] = (i-2 >= 0 ? pr[i-2] : 1)*(w-i-2 >= 0 ? pr[w-i-2] : 1)%md;
        a[i][1] = (i-2 >= 0 ? pr[i-2] : 1)*(w-i-1 >= 0 ? pr[w-i-1] : 1)%md;
    }
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            for(int l = 0; l < 3; l++){
                if((j == 1 && l == 0) || (j == w && l == 2)) continue;
                dp[i][j] = (dp[i][j] + dp[i-1][j+l-1]*a[j][l])%md;
            }
        }
    }
    for(int i = 1; i <= w; i++){
        printf("%lld %lld %lld %lld\n", a[i][0], a[i][1], a[i][2], pr[i]);
    }
    printf("%lld\n", dp[h][k]);

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:8:5: error: 'scanf' was not declared in this scope
    8 |     scanf("%d%d%d", &h, &w, &k);
      |     ^~~~~
a.cc:9:5: error: 'fill' was not declared in this scope
    9 |     fill(dp[0], dp[105], 0);
      |     ^~~~
a.cc:34:9: error: 'printf' was not declared in this scope
   34 |         printf("%lld %lld %lld %lld\n", a[i][0], a[i][1], a[i][2], pr[i]);
      |         ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | include<bits/stdc++.h>
a.cc:36:5: error: 'printf' was not declared in this scope
   36 |     printf("%lld\n", dp[h][k]);
      |     ^~~~~~
a.cc:36:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
a.cc:36:32: error: expected '}' at end of input
   36 |     printf("%lld\n", dp[h][k]);
      |                                ^
a.cc:5:11: note: to match this '{'
    5 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <cstring>

using namespace std;

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

    int dp[h+1][w];
    memset(dp, 0, sizeof(dp));
    dp[0][0] = 1;

    for (int i = 1; i <= h; i++) {
        for (int j = 0; j < (1 << (w - 1)); j++) {
            if (j & (j << 1)) {
                continue;
            }
            for (int k = 0; k < w; k++) {
                if (j & (1 << k)) {
                    dp[i][k+1] = (dp[i][k+1] + dp[i-1][k]) % z;
                } else if (k > 0 && j & (1 << (k - 1))) {
                    dp[i][k-1] = (dp[i][k-1] + dp[i-1][k]) % z;
                } else {
                    dp[i][k] = (dp[i][k] + dp[i-1][k]) % z;
                }
            }
        }
    }

    cout << dp[h][k] << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:62: error: 'z' was not declared in this scope
   22 |                     dp[i][k+1] = (dp[i][k+1] + dp[i-1][k]) % z;
      |                                                              ^
a.cc:24:62: error: 'z' was not declared in this scope
   24 |                     dp[i][k-1] = (dp[i][k-1] + dp[i-1][k]) % z;
      |                                                              ^
a.cc:26:58: error: 'z' was not declared in this scope
   26 |                     dp[i][k] = (dp[i][k] + dp[i-1][k]) % z;
      |                                                          ^
Language: C++

#include<iostream>
#include<stdio.h>
#include<cmath>
using namespace std;

  int h, w, k;

int amida(int srt,int std,int n){
    if (abs(k-srt)-1 <= h-n && 0 < srt && srt < w+1 ){
      if (h-n == 0) return 1;
      if (2<srt && srt << w-1{
        return (w-4)*(amida(srt-1,std,n+1)+amida(srt,std,n+1)+amida(srt+1,std,n+1));
      }
      else {
        if (srt == 1) return (w-3)*amida(srt,std,n+1)+(w-4)*amida(srt+1,std,n+1);
        if (srt == 2) return (w-3)*amida(srt-1,std,n+1)+(w-4)*amida(srt,std,n+1)+w-4)*amida(srt+1,std,n+1);
        if (srt == w-1) return (w-4)*amida(srt-1,std,n+1)+(w-4)*amida(srt,std,n+1)+(w-3)*amida(srt+1,std,n+1);
        if (srt == w) return (w-3)*amida(srt,std,n+1)+(w-4)*amida(srt-1,std,n+1);
      }
    }
    else return 0;
  }

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

  int result = 0;
  result  = amida(1,k,1);
  cout << result%1000000007;
}


Compiler output:
a.cc: In function 'int amida(int, int, int)':
a.cc:11:30: error: expected ')' before '{' token
   11 |       if (2<srt && srt << w-1{
      |          ~                   ^
      |                              )
a.cc:20:5: error: expected primary-expression before '}' token
   20 |     }
      |     ^
a.cc:22:3: warning: control reaches end of non-void function [-Wreturn-type]
   22 |   }
      |   ^
Language: C++

import numpy as np
def main():
 
	buf = input().split()
	h = int(buf[0])
	w = int(buf[1])
	k = int(buf[2])
 
	dpp = np.zeros((w+1, 3), dtype="int")
	dpp[0][0] = 1
	dpp[0][2] = 1
	dpp[1][0] = 1
	dpp[1][2] = 1
	for i in range(2, w+1):
		dpp[i][0] = dpp[i-1][0]+dpp[i-1][1]
		dpp[i][1] = dpp[i-1][0]
		dpp[i][2] = dpp[i][0] + dpp[i][1]
	#print(dpp)
 
	dp = np.zeros((h+1, w+2), dtype="int")
	dp[0][1] = 1
	for row in range(1, h+1):
		for col in range(1, w+1):
			dp[row][col] = dp[row-1][col-1]*dpp[col-2][2]*dpp[w-col][2] + dp[row-1][col]*dpp[col-1][2]*dpp[w-col][2] + dp[row-1][col+1]*dpp[col-1][2]*dpp[w-col-1][2]
	#print(dp)
	print(dp[h][k])
 
 
 
 
 
main()

Compiler output:
a.cc:18:10: error: invalid preprocessing directive #print
   18 |         #print(dpp)
      |          ^~~~~
a.cc:25:10: error: invalid preprocessing directive #print
   25 |         #print(dp)
      |          ^~~~~
a.cc:1:1: error: 'import' does not name a type
    1 | import numpy as np
      | ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include "stdafx.h"
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <functional>
#include <queue>

//AtCoderC++.cpp

using namespace std;

void Show(vector<vector<int>> Ns) {
	for (int i = 0; i < Ns.size(); i++) {
		for (int j = 0; j < Ns[i].size(); j++) {
			if (j == Ns[i].size() - 1) {
				cout << Ns[i][j] << endl;
			} else {
				cout << Ns[i][j] << ",";
			}
		}
	}
}

void Show(vector<int> N) {
	for (int i = 0; i < N.size(); i++) {
		cout << N[i];
		if (i != N.size() - 1) {
			cout << " ";
		} else {
			cout << endl;
		}
	}
}


int main() {
	long long Divider = 1000000007;
	int H, W, K;
	cin >> H >> W >> K;
	int initial = 0;
	switch (W) {
		case 1:
			initial = 0;
			break;
		case 2:
			initial = 1;
			break;
		case 3:
			initial = 1;
			break;
		case 4:
			initial = 2;
			break;
		case 5:
			initial = 3;
			break;
		case 6:
			initial = 5;
			break;
		case 7:
			initial = 7;
			break;
		case 8:
			initial = 11;
			break;
	}
	//Amida[i,j,k]=高さが(i+1)のとき、jからkに到るあみだくじの数
	vector<vector<vector<long long>>> AmidaTable;
	AmidaTable.resize(H);
	for (int i = 0; i < H; i++) {
		AmidaTable[i].resize(W);
		for (int j = 0; j < W; j++) {
			AmidaTable[i][j].resize(W);
		}
	}
	//H=1(横棒が1本だけ引ける)
	for (int i = 0; i < W; i++) {
		for (int j = 0; j < W; j++) {
			if (i == j) {
				AmidaTable[0][i][j] = (W == 0) ? 1 : W - 1;
			} else if (abs(i - j) == 1) {
				AmidaTable[0][i][j] = initial;
			} else {
				AmidaTable[0][i][j] = 0;
			}
		}
	}
		//あみだくじを延長する
	for (int h = 1; h < H; h++) {
		for (int i = 0; i < W; i++) {
			for (int j = 0; j < W; j++) {
				AmidaTable[h][i][j] = (AmidaTable[h - 1][i][j] * AmidaTable[0][j][j]);
				if (j != 0) {
					AmidaTable[h][i][j] += (AmidaTable[h - 1][i][j - 1] * AmidaTable[0][j - 1][j]);
				}
				if (j != W - 1) {
					AmidaTable[h][i][j] += (AmidaTable[h - 1][i][j + 1] * AmidaTable[0][j + 1][j]);
				}
				AmidaTable[h][i][j] %= Divider;
			}
		}
	}
	cout << AmidaTable[H - 1][0][K-1] << endl;
}


Compiler output:
a.cc:1:10: fatal error: stdafx.h: No such file or directory
    1 | #include "stdafx.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;

const int VERYLARGE = 1000000;
long long p = 1000000007;

long long fac_dp[VERYLARGE] = {1, 1};
long long fib_dp[VERYLARGE] = {1, 1}:

long long powp(long long a, long long b) {
    if (b == 0)
        return 1ll;
    else if (b == 1)
        return a % p;
    else if (b % 2 == 0) {
        long long t = powp(a, b/2);
        return t * t % p;
    } else {
        long long t = powp(a, b/2);
        return t * t % p * a % p;
    }
}

long long inv(long long n) {
    return powp(n, p-2) % p;
}

long long fac(long long n) {
    if (fac_dp[n] != 0) {
        return fac_dp[n];
    } else {
        for (long long i = 2; i <= n; i++) {
            if (fac_dp[i] == 0) {
                fac_dp[i] = i * fac_dp[i-1] % p;
            }
        }
        return fac_dp[n];
    }
}

long long fib(long long n) {
    if (fib_dp[n]) {
        return fib_dp[n];
    } else {
        for (long long i = 2; i <= n; i++) {
            if (fib_dp[i] == 0) {
                fib_dp[i] = (fib_dp[i-1] + fib_dp[i]) % p;
            }
        }
        return fib_dp[n];
    }
}

long long nCr(long long n, long long r) {
    return fac(n) * inv(fac(r)) % p * inv(fac(n-r)) % p;
}

int main() {
    
    long long h, w, k;
    
    cin >> h >> w >> k;
    
    cout << fib(w) * h % p / w << endl;

}

Compiler output:
a.cc:9:37: error: expected ',' or ';' before ':' token
    9 | long long fib_dp[VERYLARGE] = {1, 1}:
      |                                     ^
a.cc: In function 'long long int inv(long long int)':
a.cc:26:12: error: 'powp' was not declared in this scope
   26 |     return powp(n, p-2) % p;
      |            ^~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <vector>
#include <array>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <numeric>
using ll = long long;
using namespace std;
using pii = pair<int, int>;
using pdi = pair<double, int>;

#include "Modulo.h"

int H, W, K;
#define MOD 1000000007

int main() {
	set_mod(MOD);
	cin >> H >> W >> K;
	vector<vector<Modint>> dp(W + 1, vector<Modint>(H + 1, 0));
	dp[K][0] = 1;
	vector<Modint> right(W + 2);
	right[W] = 1;
	right[W + 1] = 1;
	for (int i = W - 1; i >= 0; i--)
	{
		right[i] = right[i + 1] + right[i + 2];
	}
	vector<Modint> left(W + 1);
	left[0] = 1;
	left[1] = 1;
	for (int i = 2; i <= W; i++)
	{
		left[i] = left[i - 1] + left[i - 2];
	}
	for (int h = 1; h <= H; h++)
	{
		for (int w = 1; w <= W; w++)
		{
			dp[w][h] = dp[w][h - 1] * left[w - 1] * right[w + 1];
			if (w != 1) {
				dp[w][h] += dp[w - 1][h - 1] * left[w - 2] * right[w + 1];
			}
			if (w != W) {
				dp[w][h] += dp[w + 1][h - 1] * left[w - 1] * right[w + 2];
			}
		}
	}

	cout << dp[1][H] << endl;
	return 0;
}


Compiler output:
a.cc:21:10: fatal error: Modulo.h: No such file or directory
   21 | #include "Modulo.h"
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;

int subcount(int n)
{
	if (n <= 0) {
		return 1;
	}
	int c = 0;
	for (int i = 0; i < (1 << n); ++i) {
		bool ok = true;
		for (int k = 0; k + 1 < n; ++k) {
			if ((i & (1 << k)) && (i & (1 << (k + 1)))) {
				ok = false;
				break;
			}
		}
		if (ok) {
			++c;
		}
	}
	return c;
}

long long memo[100][8 + 1][8 + 1];

long long solve(int H, int W, int K)
{
	if (H == 1) {
		if (K == 1) {
			return subcount(W - 2);
		}
		else if (K == 2) {
			return subcount(W - 3);
		}
		else {
			return 0;
		}
	}
	else {
		if (memo[H][W][K] >= 0) {
			return memo[H][W][K];
		}

		long long ans = 0;
		if (1 < K) {
			ans += 1LL * subcount(K - 3) * subcount(W - K - 1) * solve(H - 1, W, K - 1) % MOD;
			ans %= MOD;
		}

		ans += 1LL * subcount(K - 2) * subcount(W - K - 1) * solve(H - 1, W, K) % MOD;
		ans %= MOD;

		if (K < W) {
			ans += 1LL * subcount(K - 2) * subcount(W - K - 2) * solve(H - 1, W, K + 1) % MOD;
			ans %= MOD;
		}

		return memo[H][W][K] = ans;
	}
}

int main()
{
	int H, W, K;
	cin >> H >> W >> K;

	memset(memo, -1, sizeof memo);
	cout << solve(H, W, K) << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:71:9: error: 'memset' was not declared in this scope
   71 |         memset(memo, -1, sizeof memo);
      |         ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    1 | #include <iostream>
  +++ |+#include <cstring>
    2 |
Language: C++

#include<iostream>
#include<stdint>
using namespace std;

const int MAX = 10; // 横
const int MAX2 = 101; // 高さ
const int MOD = 1000000007; // 今回使う余り
int main() {
	int H, W, K;
	cin >> H >> W >> K;
	
	int64_t fib[MAX]; // あみだくじの場合、長さnはfib(n+1)を参照 ちょっと変則的なfibだけどね、0, 0, 1, 2, 3, 5, 8, 13, 21, ...ってなるので
	fib[1] = fib[2] = 1;
	for (int i = 3;i <= W + 1;++ i) fib[i] = fib[i - 1] + fib[i - 2];
	fib[0] = 0;
	
	int64_t dp[MAX2][MAX]; // 番兵付きなので間違えないように！dp[i][j]は高さiにおける左からj番目に辿れる組み合わせ
	for (int i = 0;i <= H;++ i) for (int j = 0;j <= W + 1;++ j) dp[i][j] = 0;
	dp[0][1] = 1;
	for (int i = 1;i <= H;++ i) {
		for (int j = 1;j <= W;++ j) {
			dp[i][j] = dp[i - 1][j - 1] * fib[j - 1] * fib[W - j + 1] + dp[i - 1][j] * fib[j] * fib[W - j + 1] + dp[i - 1][j + 1] * fib[j] * fib[W - j];
			dp[i][j] %= MOD; // 忘れずに！
		}
	}
	cout << dp[H][K];
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

上から考えていこう
まず、高さ1の時点での1の存在は、1-2に線が引かれていない場合は1に行き、その組み合わせは2からWまでの全ての横線を引く組み合わせに等しい
そして、1-2に線が引かれていれば2に行き、その組み合わせは3からWまでの全ての横線を引く組み合わせに等しい

……a-b間における組み合わせは先に計算すると良さそうなのでまず考えてみよう
平行移動しても同じなので、b-a=xとする長さを考えてf(x)で定義しよう
まず、f(0)=1, f(1)=2(引く/引かない)
f(2)=f(1)(引かない場合)+f(0)(引いた場合)
以下、f(n)=f(n-1)+f(n-2)と導出できるので、これはフィボナッチ数列になるね

次に、今辿っている位置がxにある時の次の組み合わせを考えよう
・x-1に移動する組み合わせ
・xに移動する組み合わせ
・x+1に移動する組み合わせ
これ以外はあり得ないので、これだけ考えれば良いね
まず、x-1に移動する場合、(x-1)-xにあみだが引かれたので、(x-2)-(x-1)とx-(x+1)にはあみだが引かれない
よって、この組み合わせは1-(x-2)間×(x+1)-W間の組み合わせ、よってf(x-2)*f(W-x)となる
次にxに移動する場合は(x-1)-xとx-(x+1)にはあみだが引かれないので、f(x-1)*f(W-x)となるね
最後にx+1に移動する場合はx-(x+1)にあみだが引かれ、(x-1)-xと(x+1)-(x+2)にはあみだが引かれないのでf(x-1)*f(W-x-1)となる
あ、f(-1)=0で良いよ、長さが負とかありえないので

ということは、これであみだくじを1個下に動く遷移がO(W)でできたので答えはO(HW)、間に合うね
*/

Compiler output:
a.cc:2:9: fatal error: stdint: No such file or directory
    2 | #include<stdint>
      |         ^~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>
#include<math.h>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

ll h, w, k;

ll memo[8][110];

ll dfs(ll pos, ll hei) {
	if(memo[pos][hei] != -1) return memo[pos][hei];
	if(hei == h + 1) {
		if(pos == k) return 1;
		else return 0;
	}
	ll ret = 0;
	REP(i,(1ll<<(w-1))) {
		bitset<7> bi(i);
		bool d = true;
		REP(j,w-2) if(bi[j] == 1 && bi[j + 1] == 1) d = false;
		if(!d) continue;
		bool upd = false;
		if(pos > 0 && bi[pos - 1]) {
			upd =true;
			ret += dfs(pos - 1, hei + 1);
		}
		if(pos < w - 1 && bi[pos]) {
			upd = true;
			ret += dfs(pos + 1, hei + 1);
		}
		if(!upd) ret += dfs(pos, hei + 1);
	}
	return memo[pos][hei] = ret % MOD;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> h >> w >> k;
	k--;
	if(w == 1) {
		cout << 1 << endl;
		return 0;
	}
	REP(i,8) REP(j,110) memo[i][j] = -1;
	cout << dfs(0, 1) << endl;
	return 0;
}


Compiler output:
a.cc: In function 'll dfs(ll, ll)':
a.cc:34:17: error: 'bitset' was not declared in this scope
   34 |                 bitset<7> bi(i);
      |                 ^~~~~~
a.cc:8:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    7 | #include<math.h>
  +++ |+#include <bitset>
    8 | using namespace std;
a.cc:34:27: error: 'bi' was not declared in this scope; did you mean 'i'?
   34 |                 bitset<7> bi(i);
      |                           ^~
      |                           i
Language: C

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,n,m) for(int i=(n);i<(m);i++)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) for(int i=(n);i>=0;i--)
#define all(vec) vec.begin(),vec.end()
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using P=pair<int,int>;
using PP=pair<int,P>;
using Pl=pair<ll,ll>;
using PPl=pair<ll,Pl>;
using vs=vector<string>;
#define fi first
#define se second
#define pb push_back
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
const ll MOD=1000000007LL;
const int INF=1<<30;
const ll LINF=1LL<<60;
template<int mod>
struct ModInt{
	int x;
	ModInt():x(0){}
	ModInt(long long y):x(y>=0?y%mod:(mod-(-y)%mod)%mod){}
	ModInt &operator+=(const ModInt &p){
		if((x+=p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator-=(const ModInt &p){
		if((x+=mod-p.x)>=mod)x-=mod;
		return *this;
	}
	ModInt &operator*=(const ModInt &p){
		x=(int)(1LL*x*p.x%mod);
		return *this;
	}
	ModInt &operator/=(const ModInt &p){
		*this*=p.inverse();
		return *this;
	}
	ModInt operator-()const{return ModInt(-x);}
	ModInt operator+(const ModInt &p)const{return ModInt(*this)+=p;}
	ModInt operator-(const ModInt &p)const{return ModInt(*this)-=p;}
	ModInt operator*(const ModInt &p)const{return ModInt(*this)*=p;}
	ModInt operator/(const ModInt &p)const{return ModInt(*this)/=p;}
	bool operator==(const ModInt &p)const{return x==p.x;}
	bool operator!=(const ModInt &p)const{return x!=p.x;}
	ModInt inverse()const{
		int a=x,b=mod,u=1,v=0,t;
		while(b>0){
			t=a/b;
			a-=t*b;
			swap(a,b);
			u-=t*v;
			swap(u,v);
		}
		return ModInt(u);
	}
	friend ostream &operator<<(ostream &os,const ModInt<mod> &p){
		return os<<p.x;
	}
	friend istream &operator>>(istream &is,ModInt<mod> &a){
		long long x;
		is>>x;
		a=ModInt<mod>(x);
		return (is);
	}
};

const int mod=1e9+7;
using mint=ModInt<mod>;
int main(){
	int h,w,K;
	cin>>h>>w>>K;
	vector<vector<mint>> dp(h+1,vector<mint>(w));
	dp[0][0]=1;
	REP(i,h){
		REP(j,w){
			REP(k,1<<(w-1)){
				//is it vaild?
				bool f=true;
				REP(l,w-2){
					if((k&(1<<l))&&(k&(1<<(l+1)))){
						f=false;
					}
				}
				if(!f){
					continue;
				}
				if(k&(1<<j)){
					dp[i+1][j+1]+=dp[i][j];
				}else if(k&(1<<(j-1))){
					dp[i+1][j-1]+=dp[i][j];
				}else{
					dp[i+1][j]+=dp[i][j];
				}
			}
		}
	}
	cout<<dp[h][K-1]<<endl;
	return 0;
}

Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: Java

import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        Deque<Long> deque1 = new ArrayDeque<>();
        Deque<Long> deque2 = new ArrayDeque<>();
        long[] a = new long[n];
        long[] b = new long[n];
        long[] c = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
            deque1.add(a[i]);
            deque2.add(a[i]);
        }
        Arrays.sort(a);
        b[0] = c[0] = a[n / 2];
        b[n - 1] = c[n - 1] = n % 2 == 0 ? a[n / 2 - 1] : a[n / 2] - a[n / 2 - 1] > a[n / 2 + 1] - a[n / 2] ? a[n / 2 + 1] : a[n / 2 - 1];
        deque1.remove(b[0]);
        deque1.remove(b[n - 1]);
        deque2.remove(b[0]);
        deque2.remove(b[n - 1]);

        boolean f = true;
        for (int i = 1; i < n - 1; i++) {
            long j = f ? deque1.pollFirst() : deque1.pollLast();
            long k = f ? deque2.pollLast() : deque2.pollFirst();
            Utils.println(j, k);
            b[i] = j;
            c[i] = k;
            f = !f;
        }

        long ans1 = 0, ans2 = 0;
        for (int i = 1; i < n; i++) {
            ans1 += Math.abs(b[i - 1] - b[i]);
            ans2 += Math.abs(c[i - 1] - c[i]);
        }

        System.out.println(Math.max(ans1, ans2));
    }
}

Compiler output:
Main.java:30: error: cannot find symbol
            Utils.println(j, k);
            ^
  symbol:   variable Utils
  location: class Main
1 error
Language: Java

import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
        }
        Arrays.sort(a);

        long ans = 0;
        for (int i = 0; i < n / 2; i++) {
            if (n % 2 == 0) {
                ans += a[n - i - 1] - a[n / 2 - i - 1] + (i == n / 2 - 1 ? 0 : a[n - i - 1] - a[n / 2 - i - 2]);
            } else if (a[n / 2 + 1] - a[n / 2] == a[n / 2] - a[n / 2 - 1]) {
                ans += 2 * a[n - i - 1] - a[i] - a[i + 1];
            } else if (a[n / 2 + 1] - a[n / 2] > a[n / 2] - a[n / 2 - 1]) {
                ans += 2 * a[n - i - 1] - (i == 0 ? a[n / 2] : a[i - 1]) - a[i];
            } else {
                Utils.println(a[i], (i == 0 ? a[n - 1] : a[n / 2 + i - 1]), a[n / 2 + i]);
                ans += -2 * a[i] + (i == 0 ? a[n - 1] : a[n / 2 + i - 1]) + a[n / 2 + i];
            }
        }
        System.out.println(ans);
    }
}

Compiler output:
Main.java:23: error: cannot find symbol
                Utils.println(a[i], (i == 0 ? a[n - 1] : a[n / 2 + i - 1]), a[n / 2 + i]);
                ^
  symbol:   variable Utils
  location: class Main
1 error
Language: C++

#include <bits/stdc++.h>

int n;
std::vector<int> vec, vec2;

int main() {
    std::cin >> n;
    vec.assign(n+1, 0);
    for (int i = 1; i <= n; i++) {
        std::cin >> vec[i];
    }
    std::sort(vec.begin(), vec.end());
    int p = n;
    if (n % 2 == 0) {
        int half_n = n / 2;
        for (int i = 1 i <= n; i++) {
            if (i > half_n && p <= half_n) {
                break;
            }
            vec2.push_back(vec[i]);
            vec2.push_back(vec[p]);
            p--;
        }
    }
    else {
        for (int i = 1; i <= n; i++) {
            if (i == p) {
                break;
            }
            vec2.push_back(vec[i]);
            vec2.push_back(vec[p]);
            p--;
        }
    }
    int sum = 0;
    for (int i = 1; i < n; i++) {
        sum += (vec[i]-vec[i-1]);
    }
    std::cout << sum << std::endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:23: error: expected ';' before 'i'
   16 |         for (int i = 1 i <= n; i++) {
      |                       ^~
      |                       ;
Language: C++

#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
using namespace std;
int n,a[114514];
int p[114514],q[114514];
int main(){
	//113459
	cin>>n;
	rep(i,n)cin>>a[i];
	sort(a,a+n);
	int ans1=0,ans2=0;
	if(n%2){
		p[0]=a[n/2];
		q[0]=p[0];
		REP(i,n){
			if(i%2){
				p[i]=a[i/2];
				q[i]=a[n-1-i/2];
			}else {
				p[i]=a[n-i/2];
				q[i]=a[i/2-1];
			}
		}
	}else {
		p[0]=a[n/2-1];
		q[0]=a[n/2];
		REP(i,n){
			if(i%2){
				p[i]=a[n-1-i/2];
				q[i]=a[i/2];
			}else {
				p[i]=a[i/2-1];
				q[i]=a[n-i/2];
			}
		}
	}
	REP(i,n){
		ans1+=abs(p[i]-p[i-1]);
		ans2+=abs(q[i]-q[i-1]);
	}
	cout<<max(ans1,ans2)<<endl;
}
	
	


Compiler output:
cc1plus: error: '::main' must return 'int'
Language: C++

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define reps(i, a, b) for (int i = a; i < b; i++)
#define rep(i, n) reps(i, 0, b)

ll calc(vector<ll>& v)
{
  int N = v.size();
  ll a = 0, b = 0;
  rep(i, N / 2) a += v[i];
  reps(i, N / 2, N) b += v[i];
  return abs(a-b);
}

int main()
{
  int N;
  cin >> N;
  vector<ll> v(N);
  rep(i, N) cin >> v[i];
  sort(v.begin(), v.end());
  ll res = calc(v);
  reverse(v.begin(), v.end());
  cout << max(res, calc(v)) << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:30: error: 'b' was not declared in this scope
    6 | #define rep(i, n) reps(i, 0, b)
      |                              ^
a.cc:5:43: note: in definition of macro 'reps'
    5 | #define reps(i, a, b) for (int i = a; i < b; i++)
      |                                           ^
a.cc:22:3: note: in expansion of macro 'rep'
   22 |   rep(i, N) cin >> v[i];
      |   ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
int n;
long long r = 0;
vector <int> tab;
vector <int> tab2;
int main(){
	cin >> n;
for(int i = 1 ; i<= n;i++){
	int a;
	cin >> a;
	tab.push_back(a);
}
sort(tab.begin(),tab.end());
int l = 0 , r = n-1;
while(l<r){
tab2.push_back(tab[l]);
tab2.push_back(tab[r]);
l++;
r--;
}
if(l==r)tab2.push_back(tab[l]);
for(int i = 0 ; i < n-1 ; i++){
	rez += abs(tab2[i]-tab2[i+1]);
}
cout << rez;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:9: error: 'rez' was not declared in this scope
   24 |         rez += abs(tab2[i]-tab2[i+1]);
      |         ^~~
a.cc:26:9: error: 'rez' was not declared in this scope
   26 | cout << rez;
      |         ^~~
Language: C++

#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iomanip>
#include <vector>
#include <cstdio>
#include <float.h>
#include <queue>
#include <set>
#include <map>
#include <fstream>
#include <cstdlib>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <stack>
#include <functional>
 
using namespace std;
 
#define endl '\n'
#define MOD 1000000007
#define INF 1ll<<30
#define MAX 100010
#define eps 1e-11
#define bit_max 1ll<<32
#define _USE_MATH_DEFINES


int func(int b[], int n)
{
	int s = 0;
	for(int i=0;i<n-1;i++)
	{
		s = s+abs(b[i]-b[i+1]);
	}
	return s;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>a[i];

	}
	sort(a,a+n);
	long long int sum = 0;
	if(n%2!=0)
	{	
		long long int temp =0;
		for(int i=0;i<n/2;i++)
		{
			temp = temp - 2*(a[i])
		}
		temp+=a[n/2];
		temp+=a[n/2 + 1];
		for(int i = n/2 +2 ;i<n;i++)
			temp+=(2*a[i]);
		sum = max(sum,temp);
		temp = 0;
		for(int i=0;i<n/2 - 1; i++)
			temp-=(2*a[i]);
		temp-=a[n/2 -1];
		temp-=a[n/2 ];
		for(int i=n/2 + 1;i<n;i++)
			temp+=(2*a[i]);
		sum = max(sum,temp);
	}
	else
	{
		for(int i=0;i<n/2;i++)
			sum+=(-2*a[i]);
		for(int i=n/2;i<n;i++)
			sum+=(2*a[i]);
		sum+=a[n/2 -1];
		sum-=a[n/2]	;
	}
	cout<<sum;
	return 0 ;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:47: error: expected ';' before '}' token
   66 |                         temp = temp - 2*(a[i])
      |                                               ^
      |                                               ;
   67 |                 }
      |                 ~
Language: C++

#include <bits/stdc++.h>
#define PB push_back
using namespace std;
vector<int> permut;
int brute(vector<int> values)
{
    int n = values.size();
    vector<int> permut;
    for(int i = 0; i < n; i++)
        permut.PB(i);
    int ans = 0;
    do
    {
        int curAns = 0;
        for(int i = 0; i < permut.size() - 1; i++)
        {
            curAns += abs(values[permut[i]]  - values[permut[i + 1]]);
        }
        if(curAns > ans)
        {
            ans = curAns;
        }
    }
    while(next_permutation(permut.begin() , permut.end()));
    return ans;
}
LL solve(vector<int> values)
{
    int n = values.size();
    sort(values.begin() , values.end());
    vector<int> fin(values.size());
    int idx = (n - 1) / 2;
    int cnt = (n + 1) / 2;
    int from = 0;
    while(cnt--)
    {
        fin[from] = values[idx];
        idx--;
        from += 2;
    }
    cnt = n / 2;
    idx = n - 1;
    from = 1;
    while(cnt--)
    {
        fin[from] = values[idx];
        idx--;
        from += 2;
    }
    if(n > 1 && n % 2)
    {
        swap(fin[2] , fin[n - 1]);
    }
    LL ans = 0;
    for(int i = 0; i < fin.size() - 1; i++)
        ans += abs(fin[i] - fin[i + 1]);
    return ans;
}
vector<int> gen()
{
    int n;
    cin >> n;
    vector<int> v(n);
    for(auto &x : v)
    {
        cin >> x;
    }
    return v;
}

int main() 
{
    
        vector<int> v = gen();
        vector<int> minusV;
        for(auto x : v)
            minusV.PB(-x);
        cout << max(solve(v) , solve(minusV));
       
       // cout << "OK" << endl;
    
    return 0;
}

Compiler output:
a.cc:27:1: error: 'LL' does not name a type
   27 | LL solve(vector<int> values)
      | ^~
a.cc: In function 'int main()':
a.cc:78:21: error: 'solve' was not declared in this scope
   78 |         cout << max(solve(v) , solve(minusV));
      |                     ^~~~~
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int abs(int a){
    if( a<0) return -a;
    else return a; 
}

int main() {
    int n;
    cin >> n;
    bool flag=true;
    std::vector<int> array;

    for(int i=0;i<n;i++){
    	int v;
    	cin >> v;
        array.push_back(v);
    }
    std::sort(array.begin(),array.end());
    int sum1=0,sum2=0;

    if(n%2==0){
        sum1=abs(array[0]-array[n/2]);
        sum2=abs(array[n-1]-array[n/2-1]);

    }else{
        sum1=abs(array[0]-array[n/2]) + abs(array[n/2+1]-array[n/2-1]);
        sum2=abs(array[n-1]-array[n/2])+ abs(array[n/2+1]-array[n/2-1]);
    }
    for(int i=1;i<n/2;i++){
        sum1+=abs(array[n-i]-array[i-1])+abs(array[n-i]-array[i]);
        sum2+=abs(array[n-i]-array[i-1])+abs(array[n-i-1]-array[i-1]);
    }

    if(sum1>sum2) cout<<sum1<<endl;
    else cout<<sum2<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'?
   20 |     std::sort(array.begin(),array.end());
      |          ^~~~
      |          qsort
Language: C

#include <stdio.h>
#include <stdlib.h>

typedef long long int ll;

ll a[200000];

int cmp (const void *left, const void *right) {
  int l = *(int*)left;
  int r = *(int*)right;

  if (l < r) return -1;
  if (l > r) return +1;
  return 0;
}

ll dif (ll a, ll b) {
  return (a > b) ? (a - b) : (b - a);
}
ll smax (ll a, ll b) {
  return (a > b) ? a : b;
}

ll n;
ll solve() {
  qsort(a, n, sizeof(ll), cmp);

  ll result = dif(a[n - 1], a[0]);
  ll l = 0, r = n - 1;

  while (l + 1 < r - 1) {
    result += dif(a[l], a[r - 1]) + dif(a[l + 1], a[r]);
    l++;
    r--;
  }
  if (l + 1 == r - 1) {
    result += smax(dif(a[l], a[l + 1]), dif(a[r - 1], r[r]));
  }

  printf("%lld\n", result);
}

int main(void){
  ll i;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }

  solve();
  return 0;
}


Compiler output:
main.c: In function 'solve':
main.c:37:56: error: subscripted value is neither array nor pointer nor vector
   37 |     result += smax(dif(a[l], a[l + 1]), dif(a[r - 1], r[r]));
      |                                                        ^
Language: Java

import java.util.Scanner;

// MainT1P2018D
public class MainT1P2018D {

	public static void main(String[] args) {
		try (Scanner in = new Scanner(System.in)) {
			final int N = in.nextInt();
			int d = 8*N + 1;
			int dr = (int)Math.sqrt(d);
			if (dr * dr != d) {
				System.out.println("No");
				return;
			}

			final int k = (1 + dr) / 2;

			final int[] startIdx = new int[k - 1];
			{
				int idx = 1;
				for (int i = 0; i < k - 1; ++i) {
					startIdx[i] = idx;
					idx += i + 1;
				}
			}

			System.out.println("Yes");
			System.out.println(k);
			{
				System.out.print(k - 1);
				for (int i = 0; i < k - 1; ++i) {
					System.out.print(' ');
					System.out.print(startIdx[i] + i);
				}
				System.out.println();
			}
			for (int i = 0; i < k - 1; ++i) {
				System.out.print(k - 1);
				for (int j = 0; j < i; ++j) {
					System.out.print(' ');
					System.out.print(startIdx[i] + j);
				}
				for (int j = i; j < k - 1; ++j) {
					System.out.print(' ');
					System.out.print(startIdx[j] + i);
				}
				System.out.println();
			}
		}
	}
}


Compiler output:
Main.java:4: error: class MainT1P2018D is public, should be declared in a file named MainT1P2018D.java
public class MainT1P2018D {
       ^
1 error
Language: C

        #include<iostream>
        #include<string>
        #include<algorithm>
        #include<vector>
        #include<iomanip>
        #include<math.h>
        #include<complex>
        #include<queue>
        #include<deque>
        #include<stack>
        #include<map>
        #include<set>
        #include<bitset>
        using namespace std;
        #define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
        #define rep(i,n) REP(i,0,n)
        typedef long long ll;
        typedef pair<int,int> pint;
        typedef pair<ll,int> pli;
        typedef pair<ll,ll> pll;
        const int inf=1e9+7;
        const ll longinf=1LL<<60 ;
        const ll mod=1e9+7 ;
            using namespace std;
     
            int main(){
              ll n;
              cin >> n;
              ll a[n+1];
              rep(i,n) cin >> a[i];
              sort(a,a+n);
              pll x;
              ll ans=a[n-1]-a[0];
              x.first=a[0];
              x.second=a[n-1];
              pll kouho,kouho2;
              kouho.first=a[1];
              kouho.second=1;
                kouho2.first=a[n-2];
                kouho2.second=n-2;
              for(int i=1;i<n-1;i++){
                ll le1=abs(x.first-kouho.first);
                ll le2=abs(x.first-kouho2.first);
                ll ri1=abs(x.second-kouho.first);
                ll ri2=abs(x.second-kouho2.first);
               if(le1>=le2 && le1>=ri1 && le1>=ri2){
                 ans+=le1;
                x.first=kouho.first;
                  kouho.first=a[kouho.second+1];
                   kouho.second++;
               }
                else if(le2>=le1 && le2>=ri1 && le2>=ri2){
                 ans+=le2;
                  x.first=kouho2.first;
                  kouho2.first=a[kouho2.second-1];
                    kouho2.second--;
                }
                else if(ri1>=le1 && ri1>=le2 && ri1>=ri2){
                 ans+=ri1;
                  x.second=kouho.first;
                   kouho.first=a[kouho.second+1]; 
                  kouho.second++;
                }
                else if(ri2>=le1 && ri2>=le2 && ri2>=ri1){
                 ans+=ri2;
                  x.second=kouho2.first;
                  kouho2.first=a[kouho2.second-1];
                    kouho2.second--;
                }
              }
              cout << ans << endl;
              return 0;}

Compiler output:
main.c:1:17: fatal error: iostream: No such file or directory
    1 |         #include<iostream>
      |                 ^~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
using namespace std;
int arr[100000 + 1];
int order [100000 + 1];
int main()
{
    int t , n;
    ll ans = 0, tem1;
        scanf("%d", &n);
        ans = 0;
        memset(order, 0 , sizeof order);
        for(int i = 0; i < n; i++) scanf("%d", &arr[i]);
        sort(arr , arr + n);
        int d = 0;
        for(int i = 0, j = n - 1; i <= j; d++){
            if(d % 2 == 0){
                order[d] = arr[i++];
            } else {
                order[d] = arr[j--];
            }
        }
        for(int i = 0; i < n - 1; i++) ans += abs(order[i] - order[i + 1]);
        cout << ans << "\n";
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:5: error: 'll' was not declared in this scope
    8 |     ll ans = 0, tem1;
      |     ^~
a.cc:10:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   10 |         ans = 0;
      |         ^~~
      |         abs