akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define N 1005
#define int long long
using namespace std;
int n,m,a[N];
char c[N];
long long ans;
string s;
map<string,int>g;
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%s",c+1);
		int len=strlen(c+1);
		sort(c+1,c+len+1);
		s.clear();
		for(int j=1;j<=len;j++)s+=c[j];
		g[s]++;
		ans+=g[s]-1;
	}
	printf("%lld\n",ans);
	return 0;
}

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

#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);

ll dfs(ll N, ll X, vector<ll> &M, vector<ll> &P) {
    ll ans = 0;
    if (X==0) return ans;
    else {
        rep(i,5) {
            //cout << N << " " << X << " " << ans << endl;
            if (i==0) {
                X--;
            }
            else if (i==1) {
                if (X>=M[N-1]) {
                    X -= M[N-1];
                    ans += P[N-1];
                }
                else {
                    ans += dfs(N-1,X,M,P);
                    X = 0;
                }
            }
            else if (i==2) {
                X--;
                ans++;
            }
            else if (i==3) {
                if (X>=M[N-1]) {
                    X -= M[N-1];
                    ans += P[N-1];
                }
                else {
                    ans += dfs(N-1,X,M,P);
                    X = 0;
                }
            }
            else if (i==4) {
                X--;
            }
            if (X==0) break;
        }
        //cout << ans << endl;
        return ans;
    }
}

int main(){
    ll N, X;
    cin >> N >> X;
    vector<ll> M,P;
    M.push_back(1);
    P.push_back(1);
    rep(i,50) {
        M.push_back(M[i]*2+3);
        P.push_back(P[i]*2+1);
    }

    ll ans = dfs(N,X,M,P);
    cout << ans << endl;
}

Measured memory_bytes: 3640
import java.util.HashSet

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val transit = HashSet<Int>()
    repeat(m) {
        val (a, b) = readLine()!!.split(' ').map(String::toInt)
        if (a == 1) {
            if (transit.contains(b)) {
                println("POSSIBLE")
                return
            }
            transit.add(b)
        } else if (b == n) {
            if (transit.contains(a)) {
                println("POSSIBLE")
                return
            }
            transit.add(a)
        }
    }
    println("IMPOSSIBLE")
}


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

int main() {
    int D;
    cin >> D;
    if(D == 25) cout << "Christmas" << endl;
    else if(D == 24) cout << "Christmas Eve" << endl;
    else if(D == 23) cout << "Christmas Eve Eve" << endl;
    else cout << "Christmas Eve Eve Eve" << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
	sc.Scan()
	iv, _ := strconv.Atoi(sc.Text())
	return iv
}

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	n := readInt()
	one := make([]int, 60)
	for i := 0; i < n; i++ {
		a := readInt()
		for j := 0; 1<<uint(j) <= a; j++ {
			if b := 1 << uint(j); a&b == b {
				one[j]++
			}
		}
	}

	const mod = 1000000007
	ans := 0
	for i := 0; i < 60; i++ {
		b := 1 << uint(i)
		ans += (one[i] * (n - one[i]) % mod) * (b % mod)
		ans %= mod
	}
	fmt.Println(ans)
}


Measured memory_bytes: 7424
#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wunused-result"
#define int long long
using namespace std;

#define fin(i,n) for (int i = 0; i < n; i++)
#define fin2(i,a,b) for (int i = a; i < b; i++)
#define ford(i,n) for (int i = n-1; i >= 0; i--)
#define ford2(i,a,b) for (int i = a-1; i >= b; i--)
 
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define mod 1000000007
#define PI 3.1415926535897932384626
#define EXP1 2.718281828459045
#define BIG 1000000000000000000

#define sl(n) scanf("%lld", &n)
#define sll(n,m) scanf("%lld %lld", &n, &m)
#define slll(n,m,k) scanf("%lld %lld %lld", &n, &m, &k)
#define sllll(n,m,k,o) scanf("%lld %lld %lld %lld", &n, &m, &k, &o)
#define sd(n) scanf("%lf", &n)
#define sdd(n,m) scanf("%lf %lf", &n, &m)
#define sddd(n,m,k) scanf("%lf %lf %lf", &n, &m, &k)
#define sc(c) scanf(" %c", &c)
#define ss(s) scanf("%s", s)
#define sal(t,n) fin(iz,n) { scanf("%lld", &t[iz]); }
#define sad(t,n) fin(iz,n) { scanf("%lf", &t[iz]); }
#define gl(t) scanf(" %[^\n]", t);

#define pc(n) printf("%c\n", n)
#define ps(s) printf("%s\n", s)
#define pss(s) printf("%s\n", s.c_str())
#define pl(n) printf("%lld\n", n)
#define pll(n,m) printf("%lld %lld\n", n, m)
#define plll(n,m,k) printf("%lld %lld %lld\n", n, m, k)
#define pd(n) printf("%lf\n", n)
#define pdd(n,m) printf("%lf %lf\n", n, m)
#define pal(t,n) fin(rz,n) { printf("%lld ", t[rz]); } printf("\n")
#define pad(t,n) fin(rz,n) { printf("%lf ", t[rz]); } printf("\n")

#define chmin(x, v) x = min(x, v)
#define chmax(x, v) x = max(x, v)
 
#define OK ps("OK")
#define OK1 ps("OK1")
#define OK2 ps("OK2")

#define ll int
#define vl vector<ll>
#define vvl vector<vl>
#define vvvl vector<vvl>

#define dll pair<ll, ll>
#define vdll vector<dll>
#define vvdll vector<vdll>

#define vb vector<bool>
#define vvb vector<vb>
#define vd vector<double>
#define vvd vector<vd>
#define vc vector<char>
#define vvc vector<vc>

#define all(v) v.begin(), v.end()
#define vlen(v) (int)(v.size())
#define pb push_back
#define fi first
#define se second

int n;
int a[405];
int dp[405][405];

int gdp(int l, int r)
{
    if (l == r) return 0;
    if (dp[l][r] == -1)
    {
        int s = 0;
        int m = BIG;
        for (int k = l; k < r; ++k) {
            chmin(m, gdp(l,k) + gdp(k+1,r));
            s += a[k];
        }
        s += a[r];
        dp[l][r] = s+m;
    }
    return dp[l][r];
}

signed main()
{
    int n;
    sl(n);
    sal(a, n);
    fill_n(&dp[0][0],405*405,-1);
    pl(gdp(0,n-1));
}

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

#define MAX_A   10000

int Partition(vector<int> &A, int p, int r) {
    int x=A.at(r);
    int i=p-1;
    for (int j=p; j<r; j++)
        if (A.at(j)<=x) {
            i++;
            swap(A.at(i), A.at(j));
        }
    swap(A.at(i+1), A.at(r));
    return (i+1);
};

int main() {
    int n;
    cin >>n;
    vector<int> A(n, 0);
    for (int i=0; i<n; i++)
        cin >>A.at(i);
    int Q=Partition(A, 0, n-1);
    for (int i=0; i<n; i++){
        if (i!=0)
            cout <<' ';
        if (i==Q)
            cout <<'[' <<A.at(i) <<']';
        else
            cout <<A.at(i);
    }
    cout <<endl;
    return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int N, X, s = 0, t = 1001;
  cin >> N >> X; 
  vector<int> m(N);
  for (int i = 0; i < N; i++) {
    cin >> m[i];
    s += m[i];
    t = min(t, m[i]);
  }
  
  cout << N + (X-s)/t << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ll long long
#define MOD 1000000007
#define MAX 100010
#define cout(v) REP(i,v.size()) cout << v[i] << " "; cout << endl;
using namespace std;
using Graph = vector<vector<int>>;
 
int main(){
  int k; cin>>k;
  queue<ll> que;
  FOR(i,1,10) que.push(i);
  
  REP(i,k-1){
    ll x = que.front();
    //cout << x << endl;
    que.pop();
    if(x%10 != 0) que.push(10*x + x%10 - 1);
    que.push(10*x + x%10);
    if(x%10 != 9) que.push(10*x + x%10 + 1);
  }
  cout << que.front();
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

const string STRINF = "-";
void chmax(string& a, string b){
	if(a==STRINF) a=b;
	else if(a.size()<b.size()) a=b;
	else if(a.size()==b.size() && a<b) a=b;
}

int N,M;
vector<ll> A;
ll c[9]={2,5,5,4,5,6,3,7,6};
string dp[10010];

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

	N=in(),M=in();
	A.resize(M);
	for(auto& x:A) x=in();
	for(auto& x:dp) x=STRINF;

	dp[0]="";
	for(int i=0;i<N+1;i++){
		if(dp[i]==STRINF) continue;
		for(auto& a:A) chmax(dp[i+c[a-1]],dp[i]+(char)('0'+a));
	}
	cout << dp[N] << endl;
	return 0;
}

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

int main(){
    ll n,x,ans=1e13;
    cin >> n >> x;
    vector<ll> a(2*n);
    ll b[n][n];
    for(int i = 0;i < n;i ++){
        cin >> a[i];
        a[n+i] = a[i];
    }
    for(int i = 0;i < n;i ++){
        ll ans1 = x*i;
        for(int j = 0;j < n;j ++){
            if(!i) b[i][j] = a[n+j];
            else b[i][j] = min(a[n+j-i],b[i-1][j]);
            ans1 += b[i][j];
        }
        ans = min(ans,ans1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 31488
#include<bits/stdc++.h>
 
using namespace std;
 
#define LL long long int
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int N = 1e6 + 5;
const int oo = 1e9 + 5;
const LL ooll = (LL)1e18 + 5;
const int MOD = 1e9 + 7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l, r) uniform_int_distribution<int>(l, r)(rng)

clock_t start = clock();

int sp[N], cnt[N];

void pre() {
    for (int i=1;i<N;++i) sp[i] = i;
    for (int i=2;i<N;++i) if (sp[i] == i) {
        for (int j=i+i;j<N;j+=i) sp[j] = min(sp[j], i);
    }
}

void solve() {
    pre();
    int n, g = 0;
    cin >> n;
    memset(cnt, 0, sizeof(cnt));
    bool pairwise = true;
    while(n--) {
        int x;
        cin >> x;
        g = __gcd(g, x);
        while(x > 1) {
            int p = sp[x];
            while(x % p == 0) x /= p;
            cnt[p]++;
            if (cnt[p] > 1) {
                pairwise = false;
            }
        }
    }
    if (pairwise) {
        cout << "pairwise coprime\n";
    } else if (g == 1) {
        cout << "setwise coprime\n";
    } else {
        cout << "not coprime\n";
    }
}

int main() {
    FASTIO;
    int T = 1;
    // cin >> T;
    for (int t=1;t<=T;++t) {
        solve();
    }
    // cerr << fixed << setprecision(10);
    // cerr << (clock() - start) / ((long double)CLOCKS_PER_SEC) << '\n';
    return 0;
} 

Measured memory_bytes: 11468
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while(true){
      int n = sc.nextInt();
      int r = sc.nextInt();
      if(n==0 && r==0) break;
      int[] a = new int[n];
      for(int i=0;i<n;i++){
        a[i] = n-i;
      }
      
      while(r>0){
        int p = sc.nextInt();
        int c = sc.nextInt();
        int[] b = new int[p];
        for(int i=0;i<p-1;i++){
          b[i] = a[i];
        }for(int i=0;i<c;i++){
          a[i] = a[p-1+i];
        }for(int i=0;i<p-1;i++){
          a[c+i] = b[i];
        }
        r--;
      } System.out.println(a[0]);
    }
    sc.close();
  } 
}


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

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define REP(i,n) for(long long i = 0; i < (n); i++)
#define FOR(i, m, n) for(long long i = (m);i < (n); ++i)
#define ALL(obj) (obj).begin(),(obj).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;

const ll MOD = (ll)1e9 + 7;
const ll MOD2 = 998244353;
const ll LLINF = (ll)1e18;
const ll INTINF = (ll)1e9;
const long double PI = 3.1415926535897932384626433;

template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
template <template <class tmp>  class T, class U> ostream &operator<<(ostream &o, const T<U> &obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr)o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max<T>(a,b);}
template <class T> void chmin(T& a, const T b){a=min<T>(a,b);}
void YN(bool flg) {cout << ((flg) ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << ((flg) ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << ((flg) ? "yes" : "no") << endl;}

int main() {
	while(1){
		int H,W; cin >> H >> W;
		if(H == 0 && W == 0) return 0;
		V<V<int>> a(H,V<int>(W,0));
		REP(i,H) REP(j,W) cin >> a[i][j];
		int ans = 0;
		for(int i = 0; i < (1<<H); ++i){
			auto b = a;
			for(int j = 0; j < H; ++j){
				if(i&(1<<j)) continue;
				for(int k = 0; k < W; ++k){
					b[j][k] ^= 1;
				}
			}
			int cnt = 0;
			for(int k = 0; k < W; ++k){
				int tmp = 0;
				for(int j = 0; j < H; ++j){
					tmp += b[j][k];
				}
				cnt += max(tmp,H-tmp);
			}
			chmax(ans,cnt);
		}
		cout << ans << endl;		
	}

	return 0;
}



Measured memory_bytes: 3588
#include<bits/stdc++.h>
 
using namespace std;
 
// Competetive Template:
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
// Debugging :
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
#define pb push_back
#define pf push_front
#define popb pop_back
#define popf pop_front
#define ba  back
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp make_pair 
#define mt make_tuple
#define fi first
#define se second
#define gcd __gcd
#define maxe *max_element
#define mine *min_element
#define deb debug
 
#define forz(i,n) for(long long int i=0;i<n;i++)
#define rep(i,k,n) for (lli i = k; i <= n; i++)
#define deci(n)  fixed<<setprecision(n)
#define high(n) __builtin_popcount(n)
#define parity(n) __builtin_parity(n)
#define ctz(n)  __builtin_ctz(n)
#define mod 1000000007
#define mod2 998244353
#define kira ios::sync_with_stdio(0), cin.tie(0),cout.tie(0)
 
typedef pair <lli,lli> pll;
 
 
lli countGreater(lli arr[], lli n, lli k) 
{ 
    lli l = 0; 
    lli r = n - 1; 
  
    // Stores the index of the left most element 
    // from the array which is greater than k 
    lli leftGreater = n; 
  
    // Finds number of elements greater than k 
    while (l <= r) { 
        lli m = l + (r - l) / 2; 
  
        // If mid element is greater than 
        // k update leftGreater and r 
        if (arr[m] > k) { 
            leftGreater = m; 
            r = m - 1; 
        } 
  
        // If mid element is less than 
        // or equal to k update l 
        else
            l = m + 1; 
    } 
  
    // Return the count of elements greater than k 
    return (n - leftGreater); 
}
 
bool is_palin(string input)
{
if (input == string(input.rbegin(), input.rend())) 
    return true;
return false;
}
void solve()
{
    lli k,a,b;cin>>k>>a>>b;
    for(lli i=a;i<=b;i++)
    {
    if(i%k==0)
    {
        cout<<"OK"<<endl;
        return;
    }
    }
    cout<<"NG"<<endl;
}
 
int main()
{
    kira; 
 
    lli t=1; //cin>>t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define int lint
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};



signed main(){
  string s;cin>>s;

  string ans="";
  for(int t=0;t<s.size();t+=2){
    ans+=s[t];
  }

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


Measured memory_bytes: 512
#include <stdio.h>

int main() {
  int n,m,x; //マス　料金所の数　現在地
  int i;
  int cost,costp, costm;
  int a[100] = {0};


  scanf("%d %d %d", &n,&m,&x);

  for(i = 0; i < m; i++){
    int c;
    scanf("%d", &c);
    a[c] = 1;
  }

  for(i = x; i <= n; i++){
    costp += a[i];
    // printf("%d " , a[i]);
  }

  for(i = x; i >= 0; i--){
    costm += a[i];
  }

  if(costp < costm){
    cost = costp;
  } else {
    cost = costm;
  }

  printf("%d", cost);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
const int INF = 1000000000;
int main() {
    int d[20][100][100] = {};
    int N, M, C, S, G;
    while(cin >> N >> M >> C >> S >> G && N > 0) {
        S--; G--;
        REP(i, 20) REP(j, 100) REP(k, 100) d[i][j][k] = (j == k ? 0 : INF);
        REP(i, M) {
            int x, y, di, c;
            cin >> x >> y >> di >> c;
            x--; y--; c--;
            d[c][x][y] = d[c][y][x] = min(d[c][y][x], di);
        }

        REP(c, C) REP(k, N) REP(i, N) REP(j, N) 
            d[c][i][j] = min(d[c][i][j], d[c][i][k] + d[c][k][j]);

        vector<int> P(C);
        REP(i, C) cin >> P[i];

        REP(c, C) {
            //cout <<"c " <<  c << endl;
            vector<int> Q(P[c] - 1);
            vector<int> R(P[c]);
            REP(i, P[c] - 1) cin >> Q[i];
            Q.push_back(INT_MAX);
            REP(i, P[c]) cin >> R[i];
            const int MAX_D = 20100;
            vector<int> calc(MAX_D);
            int idx = 0;
            for(int i = 1; i < MAX_D; i++) {
                if(Q[idx] < i) idx++;
                calc[i] = calc[i - 1] + R[idx];
            }

            //REP(i, N) REP(j, N) cout << d[c][i][j] << endl;
            REP(i, N) REP(j, N) if(d[c][i][j] < INF) {
                d[c][i][j] = calc[ d[c][i][j] ];
            }
            //REP(i, N) REP(j, N) cout << d[c][i][j] << endl;
            //cout <<"c " <<  c << endl;
        }
        //cout << "dist" << endl;

        int dist[100][100] = {};
        REP(i, N) REP(j, N) dist[i][j] = (i == j ? 0 : INF);
        REP(c, C) REP(i, N) REP(j, N) dist[i][j] = min(dist[i][j], d[c][i][j]);
        REP(k, N) REP(i, N) REP(j, N) dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
        if(dist[S][G] >= INF) dist[S][G] = -1;
        cout << dist[S][G] << endl;
    }
    return 0;
}

Measured memory_bytes: 2116
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
int n,K,mod;
void upd(int&a,int b){
	a=(a+b)%mod;
}
int main(){
	read(n);read(K);read(mod);
	if(~K&1){
		int f[210][210]={};
		f[1][0]=1;
		for(int i=1;i<=n;i++)
			for(int j=0;j<=i;j++){
				upd(f[i+1][0],f[i][j]);
				if(j+1<=K/2) upd(f[i+1][j+1],f[i][j]);
			}
		int now1=0,now2=0;
		for(int i=0;i<=n;i++)
			upd(now1,f[n/2+1][i]),upd(now2,f[n-n/2+1][i]);
		cout<<(1ll*now1*now2)%mod<<'\n';
	}
	else{
		map<pair<int,int>,int> f[160][160][160];
		f[1][0][0][make_pair(n+1,n+1)]=1;
		for(int i=1;i<=n;i++)
			for(int j=0;j<=i;j++)
				for(int k=0;k<=i;k++)
					if(f[i][j][k].size()){
						for(auto&pr:f[i][j][k]){
							int p=pr.first.first,q=pr.first.second;
							int tmp=pr.second;
							if(i&1){
								upd(f[i+1][0][k][make_pair(n+1,q)],tmp);
								if(i<p){
									int lim=q;
									if(i-2*k+1<=i-K) lim=min(lim,i-2*j+K);
									upd(f[i+1][j+1][k][make_pair(p,lim)],tmp);
								}
							}
							else{
								upd(f[i+1][j][0][make_pair(p,n+1)],tmp);
								if(i<q){
									int lim=p;
									if(i-2*j+1<=i-K) lim=min(lim,i-2*k+K);
									upd(f[i+1][j][k+1][make_pair(lim,q)],tmp);
								}
							}
						}
					}
		ll ans=0;
		for(int j=0;j<=n;j++)
			for(int k=0;k<=n;k++)
				for(auto pr:f[n+1][j][k]) ans=(ans+pr.second)%mod;
		cout<<ans<<'\n';
	}
	return 0;
}


Measured memory_bytes: 245760
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=1000000 +117;
const int MM=1000000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}


int m,n;
vector<int> pos[3]={};
char s[NN]={};
bool in[NN]={};
int cnt[3]={};
int a[NN]={};
int len=0;
int vis;
int kd[2][2]={};
int trans[3]={};
int revtrans[3]={};
int t[NN]={};
int main(){
	//open();
	scanf("%s",s+1);
	len=strlen(s+1);
	for(int i=1;i<=len;++i){
		if(s[i]!=s[i-1])a[++n]=s[i]-'A';
	}
	for(int i=1;i<=n;++i){
		cnt[a[i]]++;
	}
	if(!cnt[0]||!cnt[1]||!cnt[2]){
		putchar('\n');
		return 0;
	}
	int mi=0;
	for(int i=0;i<3;++i){
		if(cnt[i]<cnt[mi])mi=i;
	}
	int tp=0;
	for(int i=0;i<3;++i){
		if(i!=mi){
			revtrans[++tp]=i;
			trans[i]=tp;
		}
	}

	vis=0;
	bool first=1;
	for(int i=1;i<=n;++i){
		if(a[i]==mi){
			if(vis&1)kd[0][0]++;
			if(vis&2)kd[1][0]++;
			if(first){
				first=0;
			}
			else{
				if(vis==2)kd[1][1]++;
				if(vis==1)kd[0][1]++;
			}
			vis=0;
		}
		else{
			vis|=trans[a[i]];
		}
	}
	if(vis&1)kd[0][0]++;
	if(vis&2)kd[1][0]++;
	int big=0;
	if(kd[0][1]>kd[1][0]){
		big=1;
	}
	else{
		big=2;
	}
	int modify=max(max(kd[1][1]-kd[0][0],kd[0][1]-kd[1][0]),0);
	//delete the cutletters
	int tcnt=0;
	vis=0;
	first=1;
	for(int i=1;i<=n;++i){
		if(a[i]==mi){
			if(first){
				first=0;
			}
			else{
				if(modify&&vis==big){
					--modify;
					continue;
				}
			}
			vis=0;
		}
		else{
			vis|=trans[a[i]];
		}
		a[++tcnt]=a[i];
	}
	if(modify){
		printf("\n");
		return 0;
	}
	tcnt=unique(a+1,a+1+tcnt)-a-1;
	memset(cnt,0,sizeof cnt);
	n=tcnt;
	tcnt=0;
	for(int i=1;i<=n;++i){
		cnt[a[i]]++;
	}
	int mx=2^mi;
	for(int i=0;i<3;++i){
		if(i!=mi&&cnt[mx]<cnt[i])mx=i;
	}
	int mid=3^mi^mx;
	a[0]=-1,a[n+1]=-1;
	for(int i=1;i<=n;++i){
		if(cnt[mx]>cnt[mid]&&a[i]==mx&&a[i-1]!=a[i+1]){
			--cnt[mx];
			continue;
		}
		a[++tcnt]=a[i];
	}
	int zu=cnt[mid]-cnt[mi];
	a[0]=-1,a[tcnt+1]=-1,a[tcnt+2]=-1;
	int pre=-1;
	for(int i=1;i<=tcnt;++i){
		if(zu&&a[i]!=a[i+1]&&((a[i]^a[i+1]^mi)==3)&&pre!=a[i+2]){
			zu--;
			++i;
			continue;
		}
		pre=a[i];
		putchar(a[i]+'A');
	}
	putchar('\n');
	close();
	return 0;
}

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

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

    vector<int> count(8,0);
    int free = 0;

    for(int i=0; i<N; i++){
        int per400 = a[i]/400;
        if(per400 >= 8){
            free++;
        }
        else{
            count[per400] ++;
        }
    }

    int color;
    for(int i=0; i<8; i++){
        if(count[i] != 0){
            color ++;
        }
    }

    if(color > 0){
        cout << color << " " << color + free << endl;
    }
    else{
        cout << 1 << " " << free << endl;
    }
}


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

const long long int INF = 1000000000;

int n, m, a[50], b[50], c[50], d[50];
int res[50];

int abs(int x){
  if(x > 0){
    return x;
  }
  else{
    return -x;
  }
}

int distance(int x, int y, int z, int w){
  return abs(x - z) + abs(y - w);
}

int main(){
  cin >> n >> m;
  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
  }
  for(int i = 0; i < m; i++){
    cin >> c[i] >> d[i];
  }

  for(int i = 0; i < n; i++){
    int dmin = INF;
    for(int j = 0; j < m; j++){
      int dij = distance(a[i], b[i], c[j], d[j]);
      if(dij < dmin){
	dmin = dij;
	res[i] = j;
      }
    }
  }

  for(int i = 0; i < n; i++){
    cout << res[i] + 1 << endl;
  }
}


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

#define pb         push_back

typedef long long ll;
const ll INF = 1000000000000000000ll;
const ll MOD = 1000000007ll;
const double EPS = 1e-8;

int main(void) {
	//ios_base::sync_with_stdio(false);
	//cin.tie(0);
	
	string o, e;
	cin >> o >> e;

	for(int i=0; i<e.size(); i++){
		cout << o[i];
		cout << e[i];
	}
	if(o.size() > e.size()) cout << o[o.size()-1];
	puts("");
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;


int main() {
  string S;

  cin >> S;

  int length = S.size();
  char tmp = '0';
  int cnt = 0;

  for (int i = 0; i < length; i++) {
    if (tmp != S[i]) {
      cnt += 1;
      tmp = S[i];
    }
  }

  cout << cnt - 1 << endl;

  return 0;
}





Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    long long N,i,mod;
    mod=998244353;
    cin>>N;
    long long D[N],a,b[N];
    for(i=0;i<N;i++){
        cin>>D[i];
        b[i]=0;
    }
    a=1;
    if(D[0]!=0){
        a=0;
    }
    sort(D,D+N);
    b[0]=1;
    for(i=1;i<N;i++){
        if(D[i]==0){
            a=0;
        }
        a=(a*b[D[i]-1])%mod;
        b[D[i]]++;
    }
    cout<<a<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#define MOD 1000000007
using namespace std;

int main(){
    int N, M;
    long long ans = 1;
    cin >> N >> M;
    if(abs(N - M) > 1){
        cout << 0 << endl;
        return 0;
    }
    if(N == M){
        ans = 2;
    }
    for(int i = 1; i <= N; i++){
        ans = ans*i % MOD;
    }
    for(int i = 1; i <= M; i++){
        ans = ans*i % MOD;
    }
    cout << ans << endl;
    return 0;
}

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

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

pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

pub fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn dist(a: u64, b: u64) -> u64 {
    if a > b {
        a - b
    } else {
        b - a
    }
}

fn main() {
    let n: usize = read();
    let avec: Vec<u64> = read_vec();
    let mut min: u64 = 2020202020000000;
    let mut tmp: u64 = 0;

    let mut l: u64 = 0;
    for i in 0..n {
        l += avec[i];
    }

    for i in 0..n {
        tmp += avec[i];
        let d = dist(tmp, l - tmp);
        if d < min {
            min = d;
        }
    }

    println!("{}", min);
}


Measured memory_bytes: 13560
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

void solve(){
    int n, x, t;
    cin >> n >> x >> t;
    cout << (n+x-1)/x * t << '\n';
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

Measured memory_bytes: 3604
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#define forn(i, n) for (long long i = 0; i < (long long) (n); ++i)
#define pb emplace_back
#define endl '\n'

template<typename T> void _dbg(const char*_s,T _h) { cerr<<_s<<" = "<<_h<<"\n"; }

template<typename T, typename... Ts> void _dbg(const char*_s,T _h,Ts... _t) {
    for(int _b=0;((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',';)cerr<<*_s++;
    cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);
}

#define int long long

#ifdef LOCAL
    #define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
    #define dbg(...)
#endif

const int N = 500 * 1000 + 17;
const int MOD = 1000 * 1000 * 1000 + 7;

int n, t;
int c[N], p[N], L[N], R[N], cnt[N], ans[N];
vector<int> g[N], gg[N];
vector<int> vec[N], roots[N];

bool read() {
    if (!(cin >> n))
        return false;

    forn (i, n) {
        cin >> c[i];
        --c[i];
    }

    forn (i, n - 1) {
        int u, v;
        cin >> u >> v;
        g[u - 1].pb(v - 1);
        g[v - 1].pb(u - 1);
    }

    return true;
}

void dfs(int v, int pr) {
    if (vec[c[v]].empty()) {
        roots[c[v]].pb(v);
    } else {
        gg[vec[c[v]].back()].pb(v);
    }

    vec[c[v]].pb(v);
    cnt[v] = 1;
    L[v] = t++;
    p[v] = pr;

    for (auto to : g[v])
        if (to != pr) {
            dfs(to, v);
            cnt[v] += cnt[to];
        }

    vec[c[v]].pop_back();
    R[v] = t - 1;
}

bool anc(int v, int u) {
    return L[v] <= L[u] && R[u] <= R[v];
}

void solve(int id = 0) {
    dfs(0, -1);

    forn (v, n) {
        int i = 0;

        for (auto to : g[v]) {
            if (to == p[v])
                continue;

            int nn = cnt[to];

            for (; i < gg[v].size() && anc(to, gg[v][i]); ++i)
                nn -= cnt[gg[v][i]];

            ans[c[v]] += nn * (nn - 1) / 2 + nn;
        }
    }

    forn (i, n) {
        int nn = n;

        for (auto to : roots[i])
            nn -= cnt[to];

        ans[i] += nn * (nn - 1) / 2 + nn;
        cout << n * (n - 1) / 2 + n - ans[i] << endl;
    }
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    //cin >> T;
    T = 1;

    while (read())
        solve(T++);

    return 0;
}


Measured memory_bytes: 92112
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rep2(r, aa, bb) for (ll r = (aa)-1; r >= (bb); r--)
#define be(x) (x.begin(), x.end())
#define pb(t) push_back(t)
#define ll long long
#define mp(a, b) make_pair(a, b)
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, ans=0;
    string s;
    cin>>n>>s;
    rep(i,0,n-3+1){
		if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){
		ans++;
		}
	}
	cout<<ans<<'\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int N, M, Oa = 0;
    cin >> N >> M;
    vector<int> A(M);
    for(int &a : A){
        cin >> a;
        Oa += a & 1;
    }
    if(Oa > 2) cout << "Impossible";
    else{
        if(M == 1){
            if(N == 1) cout << "1\n1\n1";
            else cout << N << "\n2\n" << N - 1 << " 1";
        }
        else{
            for(int i = 1; i < M - 1; i += 1) if(A[i] & 1){
                if(!(A[0] & 1)) swap(A[0], A[i]);
                else swap(A[i], A[M - 1]);
            }
            for(int &a : A) cout << a << " ";
            cout << "\n";
            if(A[0] == 1) cout << M - 1 << "\n";
            else cout << M  << "\n" << A[0] - 1 << " ";
            for(int i = 1; i < M - 1; i += 1) cout << A[i] << " ";
            cout << A[M - 1] + 1;
        }
    }
    return 0; 
}

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

#define I_AM_SPEED ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
using ll = long long;

int32_t main() {
	int n;
	cin >> n;
	string s;
	vector<string> v = {"AC", "WA", "TLE", "RE"};
	unordered_map<string, int> m = {{"AC",  0},
	                                {"WA",  0},
	                                {"TLE", 0},
	                                {"RE",  0}};
	for (; cin >> s;) {
		m[s]++;
	}
	for (int i = 0 ; i < 4  ; i++) {
		string x = v[i];
		cout << x << " x " << m[x] << endl;
	}
}

Measured memory_bytes: 3596
#include<stdio.h>
int main(void){
  int n;
  double sum=0;
  double x[11]={0};
  char u[11];
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%lf",&x[i]);
    scanf("%s",&u[i]);
     if(u[i]=='B'){
       sum=sum+(x[i]*380000.0);
    }
    else {
    sum=sum+x[i];
    }
  }
  printf("%f",sum);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <assert.h>
#include <deque>
using namespace std;

typedef unsigned long long UL;
typedef long long LL;
typedef long double LD;
#define LP(i, a, b) for (LL i = int(a); i < int(b); i++)
#define LPE(i, a, b) for (LL i = int(a); i <= int(b); i++)
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef vector<vector<PII> > WAL;
typedef vector<vector<int> > SAL;
#define Ep 1e-8
#define INF 1e9
#define LINF 1e18

LL const MOD = 1e9 + 7;
LL const MaxSize = 1e5 + 5;
//LL const MOD = 998244353;

/*

 https://atcoder.jp/contests/abc110/tasks/abc110_c
 #C - String Transformation
 */

//NOTE WORKS ONLY WHEN MOD IS PRIME
//test case, either = 1 or all = 1
//NOTE WORKS ONLY WHEN MOD IS PRIME
string S;
LL cnt[MaxSize][13];

int main() {
	ios_base::sync_with_stdio(false);
	//freopen("/Users/georgeli/A_1.in", "r", stdin);
	cin >> S;
	LPE(i, 0, S.size())
	{
		memset(cnt[i], 0, sizeof(cnt[i]));
	}

	cnt[0][0] = 1;

	LP(i, 0, S.size())
	{
		if (S[i] == '?') {
			LP(r, 0, 13)
			{
				LPE(d, 0, 9)
				{
					LL nd = (r * 10 + d) % 13;
					cnt[i + 1][nd] += cnt[i][r];
					cnt[i + 1][nd] %= MOD;
				}
			}

		} else {
			LL d = S[i] - '0';
			LP(r, 0, 13)
			{
				LL nd = (r * 10 + d) % 13;
				cnt[i + 1][nd] = cnt[i][r];
			}
		}
	}

	cout << cnt[S.size()][5];

	return 0;

}


Measured memory_bytes: 10604
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

int h, w;
char maze[30][30];

int bfs(int sx, int sy) {
  int dx[] = {-1, 0, 0, 1};
  int dy[] = {0, -1, 1, 0};

  int dist[30][30];
  for (int i = 0; i < 30; i++) {
    for (int j = 0; j < 30; j++) {
      dist[i][j] = -1;
    }
  }

  queue<pair<int, int> > q;
  q.push( make_pair(sx, sy) );
  dist[sy][sx] = 0;

  while (!q.empty()) {
    int x = q.front().first;
    int y = q.front().second;
    q.pop();
    for (int i = 0; i < 4; i++) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (nx < 0 || nx >= w || ny < 0 || ny >= h) { continue; }
      if ( maze[ny][nx] == '#' ) { continue; }
      if ( dist[ny][nx] != -1  ) { continue; }
      dist[ny][nx] = dist[y][x] + 1;
      q.push( make_pair(nx, ny) );
    }
  }
  int ret = -1;
  for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
      ret = max(ret, dist[y][x]);
    }
  }
  return ret;
}

int main () {
  cin >> h >> w;
  for (int i = 0; i < h; i++) { cin >> maze[i]; }

  int ans = 0;

  for (int sx = 0; sx < w; sx++) {
    for (int sy = 0; sy < h; sy++) {
      if (maze[sy][sx] == '#') { continue; }
      ans = max(ans, bfs(sx, sy));
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
#define int long long
using namespace std;
signed main() {
    char C;
    cin >> C;
    string alphabet = "abcdefghijklmnopqrstuvwxyz";
    for (int i = 0; i < 26; i++) {
        if (C == alphabet.at(i)) {
            cout << alphabet.at(i + 1) << endl;
        }
    }
}

Measured memory_bytes: 3560
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define INF (1e9)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
const long double PI = acos(-1.0L);
const long long MOD = 1000000007LL;
// const long long MOD = 998244353LL;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
////////////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll N,D,A; cin >> N >> D >> A;
    vector<pll> H(N);
    rep(i,N) cin >> H[i].first >> H[i].second;

        sort(all(H));
        auto B = H;
        rep(i,N) {
            B[i].second = (B[i].second+A-1LL) / A;
        }
        ll k = 0;
        map<ll,ll> dic;
        dic.emplace(-1,0);
        for (ll i = 0; i < N; i++) {
            auto it = dic.lower_bound(max(0LL,B[i].first-2LL*D));
            k += max(0LL,B[i].second-k+prev(it)->second);
            dic.emplace(B[i].first,k);
        }
        cout << k << endl;
}


Measured memory_bytes: 19072
package main

import (
	"math/rand"
	"time"
	"os"
	"bufio"
	"fmt"
	"strconv"
	"strings"
)

var(
	sc = bufio.NewScanner(os.Stdin)
	stdin = bufio.NewReader(os.Stdin)
	mod = 1000000007
	mod9 = 1000000009
)

func init()  {
	rand.Seed(time.Now().UnixNano())
	buf := make([]byte, 0) //ここのサイズは何でもよさそう
	sc.Buffer(buf, 1000000009)
}


//||||||||||||||||||||||||||入力|||||||||||||||||||||||||||||||||||||||\
//数字一文字入力
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

//文字列を一行入力
func nextLine() string {
	sc.Scan()
	return sc.Text()
}

//空白区切りの文字列の入力
func spaceLine() []string {
	sc.Scan()
	return strings.Split(sc.Text()," ")
}

//数字を一行入力
func intLine() []int {
	str := spaceLine()
	buf := make([]int,len(str))
	for i,s:=range str{
		buf[i],_ = strconv.Atoi(s)
	}
	return buf
}

//次のスペースか改行まで読み込む
func gostring() string {
	byte_ls := make([]byte,0)
	for  {
		b, _ := stdin.ReadByte()
		if b == 32 || b == 10 || b == 0{
			return string(byte_ls)
		} else if b == 13 {
			continue
		} else {
			byte_ls = append(byte_ls,b)
		}
	}
}

//上の関数のintバージョン
func goint() int {
	n,_ := strconv.Atoi(gostring())
	return n
}

//|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

//ソートする
//sは最初のインデックス fは最後のインデックス
func Sort(ls []int,l int,r int)  {
	if r - l <= 0{return}
	pipot := l + rand.Intn(r-l+1)
	ls[r],ls[pipot] = ls[pipot],ls[r]
	i := l
	for j:=l;j<r;j++{
		if ls[j] < ls[r]{
			ls[i],ls[j] = ls[j],ls[i]
			i ++
		}
	}
	ls[i],ls[r] = ls[r],ls[i]
	Sort(ls,l,i-1)
	Sort(ls,i+1,r)
}

//配列の大小を指定した要素で比較
//a < bならtrue
func sizeCheck(a []int,b []int,ls []int) bool {
	for _,i:= range ls{
		if a[i] < b[i]{
			return true
		} else if a[i] > b[i] {
			return false
		}
	}
	return false
}

//二次元配列のソート
func Sort2D(ls [][]int,l int,r int,index ...int)  {
	if r - l <= 0{return}
	pipot := l + rand.Intn(r-l+1)
	ls[r],ls[pipot] = ls[pipot],ls[r]
	i := l
	for j:=l;j<r;j++{
		if sizeCheck(ls[j],ls[r],index){
			ls[i],ls[j] = ls[j],ls[i]
			i ++
		}
	}
	ls[i],ls[r] = ls[r],ls[i]
	Sort2D(ls,l,i-1,index ...)
	Sort2D(ls,i+1,r,index ...)
}

func main() {
	n := goint()
	a := make([]int,n)
	//ゼロをチェック
	checkZero := false
	//負の数の数をチェック
	mnum := 0
	for i:=0;i<n;i++{
		b := goint()
		if b < 0{mnum ++}
		a[i] = abs(b)
		if a[i] == 0{checkZero = true}
	}
	//最小値
	minval := min(a ...)
	//合計
	s := sum(a ...)
	if checkZero || mnum % 2 == 0{
		fmt.Println(s)
	} else {
		fmt.Println(s - 2 * minval)
	}
}

func sum(a ...int) int {
	ans := 0
	for i:=0;i<len(a);i++{
		ans += a[i]
	}
	return ans
}

func min(a ...int) int {
	ans := a[0]
	for i:=1;i<len(a);i++{
		if ans > a[i]{
			ans = a[i]
		}
	}
	return ans
}

func abs(n int) int {
	if n >= 0{
		return n
	} else {
		return -n
	}
}

Measured memory_bytes: 5376
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	sum := 0

	for i := 1; i <= n; i++ {
		if i%3 != 0 && i%5 != 0 {
			sum += i
		}
	}
	fmt.Println(sum)
}


Measured memory_bytes: 1752
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};

string mcxi(int x) {
	string s = ""; int y;
	y = x % 10;
	if (y) s += 'i';
	if (y >= 2) s += y + '0';
	x /= 10;
	y = x % 10;
	if (y) s += 'x';
	if (y >= 2) s += y + '0';
	x /= 10;
	y = x % 10;
	if (y) s += 'c';
	if (y >= 2) s += y + '0';
	x /= 10;
	y = x % 10;
	if (y) s += 'm';
	if (y >= 2) s += y + '0';
	x /= 10;
	reverse(s.begin(), s.end());
	return s;
}

int main() {
	map<string, int> m;
	for (int x = 1; x <= 9999; x++)
		m[mcxi(x)] = x;
	int n; cin >> n;
	while (n--) {
		string s, t; cin >> s >> t;
		cout << mcxi(m[s] + m[t]) << endl;
	}
}

Measured memory_bytes: 2308
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a;
  cin >> a;
  int b = a % 2;
  int c = (a - b) / 10 % 2;
  int d = ((a - b) / 10 - c) / 10 % 2;
  cout << b + c + d << endl;
}

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

VL lucas(100);
 
int main() {
    ll n;
    cin >> n;
 
    lucas[0] = 2;
    lucas[1] = 1;
    for (ll i = 2; i <= n; i++) {
        lucas[i] = lucas[i-1] + lucas[i-2];
    }
    cout << lucas[n] << endl;
    return 0;
}

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

int main(){
  int N,sum = 0;
  cin >> N;
  vector<int>vec(N);
  for(int i=0; i<N; i++){
    cin >> vec[i];
    sum += vec[i];
  }
  int M;
  cin >> M;
  for(int i=0; i<M; i++){
    int x = sum;
    int a,b;
    cin >> a >> b;
    x += b-vec[a-1];
    cout << x << endl;
  }
}

Measured memory_bytes: 3636
#include <cstdio>
using namespace std;

typedef long long LL;

int main()
{
    LL n, a, b;
    scanf("%lld%lld%lld", &n, &a, &b);
    if(n == 1){
        if(a == b)
            printf("1");
        else
            printf("0");
        return 0;
    }
    else if(b >= a){
        printf("%lld", (n - 1) * b + a + 1 - ((n - 1) * a + b));
    }
    else
        printf("0");

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;



int main() {
  int N;
  cin >> N;
  vector<vector<pair<int,int>>> info;

  rep(i,N){
    vector<pair<int,int>> coms;
    int A;
    cin >> A;
    rep(j,A){
      int x,y;
      cin >> x >> y;
      auto p= make_pair(x,y);
      coms.push_back(p);
    }
    info.push_back(coms);
  }

  int ans=0;
  int k=0;
  rep(tmp,(1<<N)){
    bitset<15> s(tmp);
    //one pattern
    rep(i,N){
      //No. i is honest
      if(s.test(i)){
        //get his comment
        auto v= info.at(i);
        rep(j,v.size()){
          if(v.at(j).second != s.test(v.at(j).first-1)) goto bye;
        }
      }
    }
    k=s.count();
    bye:
    ans=max(k,ans);
  }
  cout << ans;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

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

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  lli n, W;
  while (cin >> n >> W) {
    int w[n];
    int v[n];
    for (int i = 0; i < n; ++i) {
      cin >> w[i] >> v[i];
    }

    const lli base = w[0];
    
    const int N = 100 + 5;
    const int M = N * 3;
    static lli dp[N][N][M];
    fill(&dp[0][0][0], &dp[N - 1][N - 1][M - 1] + 1, -(1LL << 60));
    dp[0][0][0] = 0;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        for (int k = 0; k < M; ++k) {
          if (0 <= dp[i][j][k]) {
            // add
            lli& x = dp[i + 1][j + 1][k + w[i] - base];
            x = max(x, dp[i][j][k] + v[i]);
            // ignore
            lli& y = dp[i + 1][j][k];
            y = max(y, dp[i][j][k]);
          }
        }
      }
    }
    lli mx = 0;
    for (int i = 0; i < N; ++i) {
      for (int j = 0; j < N; ++j) {
        for (int k = 0; k < M; ++k) {
          if (j * base + k <= W)  {
            mx = max(mx, dp[i][j][k]);
          }
        }
      }
    }
    cout << mx << endl;
  }
  
  return 0;
}


Measured memory_bytes: 27392
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int main() {
	int n;
	cin >> n;
	set<int> s;
	int tp;
	rep(i,n){
		cin >> tp;
		s.insert(tp);
	}
	cout << s.size() << endl;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota
#include <cstdio> // printf, scanf
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <iomanip> // cout<<setprecision(n)
#include <functional> // function<void(int)>
#include <cmath>
#include <cassert>
#include <bitset>
#include <stack>

#ifdef DEBUG
#include "debug.hpp"
#else
#define debug(...)
#endif

#define int long long // at least int64 > 9*10^18
#define EL '\n'
#define rep(i,n) for(int i = 0; i < (n); i++)
#define print(i) std::cout << (i) << '\n'
#define all(v) (v).begin(), (v).end()
using Graph = std::vector<std::vector<int> >;
const int INF = 1e17;
/* libraries */

signed main() {
	int x;
	std::cin >> x;
	int n=1e3;
	for(int a=-n;a<=n;a++) {
		int a5=a*a*a*a*a;
		int sign=((x-a5)>0)?1:-1;
		int y=(x-a5)*sign;
		for(int b=0;b<=n;b++) {
			int b5=b*b*b*b*b;
			if(b5==y) {
				std::cout << a << ' ' << -1*sign*b << EL;
				return 0;
			}
		}
	}
	return 0;
}


Measured memory_bytes: 3624