akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;


const ll MAX = 10000000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// NのP乗をMで割った余りを返す
ll pow_mod(ll n,ll k,ll m){
  if(k==0){
    return 1;
  }else if(k%2==1){
    return pow_mod(n,k-1,m)*n%m;
  }else{
    ll t=pow_mod(n,k/2,m);
    return (t*t)%m;
  }
}

//(10*9*8)/(3*2*1);
//10*9*8 -> ansMul
//3*2*1 -> ansDiv
long calcComb(int a, int b) {
	if (b > a - b) return calcComb(a, a - b);


	long ansMul = 1;
	long ansDiv = 1;
	for (int i = 0; i < b; i++)
	{
		ansMul *= (a - i);
		ansDiv *= (i + 1);
		ansMul %= MOD;
		ansDiv %= MOD;
	}
	//ansMul / ansDivをやりたい
	//ansDivの逆元を使って求めよう！

	long ans = ansMul * pow_mod(ansDiv,MOD - 2,MOD);
	return ans;
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int N,M;
  cin >> N >> M;
  map<int,int> mp;
  ll ans=1;
  for(int i=2;i*i<=M;i++){
    while(M%i==0){
      mp[i]++;
      M/=i;
    }
  }
  COMinit();
  for(auto e:mp){
    ans*=calcComb(e.second+N-1,N-1)%MOD;
    ans%=MOD;
  }
  if(M!=1){
    ans=(ans*(N)%MOD)%MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 234624
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int ll;
typedef unsigned long long int ull; 
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a, b)*b;}
int dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

ll n;

int main(){
  cin>>n;
  ll ans=0;
  for(int i=1;i<=n;i++){
    ll l=(n/i)*i;
    ll k=(l-i)/i+1;
    ans+=((k*(i+l)/2));
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3508
#include <bits/stdc++.h>
using namespace std;
long long a,b,c,d,e[101],f[101],maxn=-101,minn=101;
bool panduan(long long g)
{
	if (maxn<=g&&minn>g)
		return true;
	else
		return false;
}
int main()
{
	cin>>a>>b>>c>>d;
	for (long long i=0;i<a;i++)
		cin>>e[i];
	for (long long i=0;i<b;i++)
		cin>>f[i];
	for (long long i=0;i<a;i++)
		maxn=max(maxn,e[i]);
	for (long long i=0;i<b;i++)
		minn=min(minn,f[i]);	
	for (long long i=min(c,d);i<max(c,d);i++)
		if (panduan(i))
		{
			cout<<"No War"<<endl;
			return 0;		
		}
	cout<<"War"<<endl;
	return 0;	
}

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

int main(){
  int n,d;
  cin >> n >> d;
  int x[n][d];
  rep(i,n){
    rep(j,d){
      cin >> x[i][j];
    }
  }
  
  int count = 0;
  
  rep(i,n){
    rep(j,i){
      int sum = 0;
      rep(k,d){
        sum += (x[i][k]-x[j][k])*(x[i][k]-x[j][k]);
      }
      rep(k,401){
        if(sum == k*k){
          count++;
          break;
        }
      }
    }
  }
  
  cout << count << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;
 
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
 
template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}
 
// ------------------------------------------------------------------------------------------

map<vector<int>, int> mp;

void init() {
   vector<int> v(8);
   iota(all(v), 0);
   mp[v] = 0;
   queue<vector<int>> que;
   que.push(v);

   while (que.size()) {
      vector<int> cur = que.front(); que.pop();
      int idx = find(all(cur), 0) - cur.begin();
      int y = idx / 4, x = idx % 4;
      rep (i, 4) {
         int ny = y + dy[i], nx = x + dx[i];
         if (ny < 0 || ny >= 2 || nx < 0 || nx >= 4) continue;
         vector<int> next = cur;
         int nc = 4 * ny + nx;
         swap(next[idx], next[nc]);
         if (mp.count(next)) continue;
         mp[next] = mp[cur] + 1;
         que.push(next);
      }
   }
}

int main() {
   init();
   vector<int> vs(8);
   while (cin >> vs[0]) {
      repp (i, 1, 8) cin >> vs[i];
      cout << mp[vs] << endl;
   }

   return 0;
}


Measured memory_bytes: 5672
DE = 10**9 + 7
N, K = list(map(lambda x: int(x), input().split(' ')))
A = list(map(lambda x: int(x), input().split(' ')))

def main():
  A_posi = []
  A_nega = []
  for a in A:
    if a > 0:
      A_posi.append(a)
    elif a < 0:
      A_nega.append(-a)

  len_posi = len(A_posi)
  len_nega = len(A_nega)
  
  if len_posi + len_nega < K:
    return 0

  if (len_nega % 2 == 1 and K == len_posi + len_nega) or (K % 2 == 1 and len_posi == 0):
    if len_posi + len_nega == N:
      A_posi.sort()
      A_nega.sort()
      answer = 1
      k = 0
      for a in A_nega:
        answer *= (- a) % DE
        answer %= DE
        k += 1
        if k >= K:
          break
      else:
        for a in A_posi:
          answer *= a % DE
          answer %= DE
          k += 1
          if k >= K:
            break
      return answer
    else:
      return 0
  A_posi.sort(reverse=True)
  A_nega.sort(reverse=True)
  posi = 0
  nega = 0
  answer = 1

  if K % 2 == 1:
    answer = A_posi[0] % DE
    posi = 1

  while posi + nega + 2 <= K:
    p = A_posi[posi] * A_posi[posi + 1] if posi + 1 < len_posi else 0
    n = A_nega[nega] * A_nega[nega + 1] if nega + 1 < len_nega else 0
    if p > n:
      answer *= p % DE
      answer %= DE
      posi += 2
    else:
      answer *= n % DE
      answer %= DE
      nega += 2

  return answer

print(main())

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

using namespace std;

void putQueen(int);
void printBoard(void);
void initialize(void);

#define MAX 8
#define FREE -1
#define NOT_FREE 1

bool X[MAX][MAX];
int row[MAX],col[MAX];
int dpos[2*MAX-1],dneg[2*MAX-1];


int main(){
  int i,j;
  int k,r,c;
  initialize();
  for(i = 0; i < MAX; i++){
    for(j = 0; j < MAX; j++){
      X[i][j] = false;
    }
  }
  cin >> k;
  for(i = 0; i < k; i++){
    cin >> r;
    cin >> c;
    X[r][c] = true;
  }
  putQueen(0);
  return 0;
}

void putQueen(int i){
  int j;
  if( i == MAX ){
    printBoard();
    return;
  }
  for(j = 0; j <= MAX-1; j++){
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE ||
       dneg[i-j+MAX-1] == NOT_FREE){
        continue;
    }
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+MAX-1] = NOT_FREE;
    putQueen(i+1);
    col[j] = dpos[i+j] = dneg[i-j+MAX-1] = FREE;
  }
}

void printBoard(){
  int i,j;
  for(i = 0; i < MAX; i++){
    for(j = 0; j < MAX; j++){
      if(0 < X[i][j]){
        if(row[i] != j){
          return;
        }
      }
    }
  }
  for(i = 0; i < MAX; i++){
    for(j = 0; j < MAX; j++){
      if(row[i] == j){
        cout << "Q";
      }
      else{
        cout << ".";
      }
    }
    cout << endl;
  }
}

void initialize(){
  int i,j;
  for(i = 0; i < MAX; i++){
    row[i] = FREE;
    col[i] = FREE;
  }
  for(j = 0; j < MAX; j++){
     dpos[i] = FREE;
     dneg[i] = FREE;
  }
}

Measured memory_bytes: 3104
//============================================================================
// Name        : HairetuTest.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	int a,x;
	a=1;
	while(1){
		cin>>x;
		if(x==0)break;
		cout<<"Case "<<a<<": "<<x<<endl;
		a++;
	}
return 0;
}



Measured memory_bytes: 3080
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    if (r<1200) { System.out.println("ABC"); }
    else if (r<2800) { System.out.println("ARC"); }
    else { System.out.println("AGC");}
  }
}


Measured memory_bytes: 21844
import java.io.*;
import java.math.*;
import java.util.*;
public class Main { 
 
	public static void main(String[] args) { 
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		long ans = 0;
		long N = I.nextLong();
		long A = I.nextLong();
		long B = I.nextLong();
		if (A<=B&&N>=2) {
			N-=2;
			long lo = N*A;
			long hi = N*B;
			ans=hi-lo+1;
			ans = Math.max(ans, 0);
		}else if (N==1&&A==B) ans++;
		O.pln(ans);
	}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return Math.max(a,b);
		return GCD(Math.min(a, b),Math.max(a, b)%Math.min(a, b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
	}
}

Measured memory_bytes: 25620
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

#define double long double

int K, N;
double p[200010];
double E[200010];
double acc[200010];

signed main(){
    cin >> N >> K;
    REP(i, N){
        cin >> p[i];
        p[i] = (1 + p[i]) / 2;
    }
    double ans = 0, sum = 0;
    REP(i, K) sum += p[i];
    ans = sum;
    REP(i, N - K){
        sum = sum - p[i] + p[i + K];
        ans = max(ans, sum);
    }
    printf("%.9Lf\n", ans);
    return 0;
}

Measured memory_bytes: 6892
(defun palindrome (s)
  (let ((mid (floor (length s) 2)))
    (loop for a across (subseq s 0 mid)
	  for b across (reverse (subseq s mid))
	  count (not (equal a b)))))

(defun main ()
  (let ((s (read-line)))
    (format t "~A~%" (palindrome s))))

(main)

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

void Init(int n);
int Root(int x);
bool Unite(int x, int y);

int root[SIZE];

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

    int N, M;
    cin >> N >> M;

    Init(N);
    while(M--) {
        int X, Y, Z;
        cin >> X >> Y >> Z;
        Unite(X, Y);
    }

    set<int> st;
    for(int i = 1; i <= N; ++i) {
        Root(i);
        st.insert(root[i]);
    }
    cout << st.size() << endl;
    return 0;
}

void Init(int n) {
    for(int i = 1; i <= n; ++i) {
        root[i] = i;
    }
}

int Root(int x) {
    if(x == root[x]) return x;
    return root[x] = Root(root[x]);
}

bool Unite(int x, int y) {
    x = Root(x);
    y = Root(y);
    if(x == y) return false;

    root[x] = y;

    return true;
}


Measured memory_bytes: 5376
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
 
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
 
    def size(self, x):
        return -self.parents[self.find(x)]
 
    def same(self, x, y):
        return self.find(x) == self.find(y)
 
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]
 
    def group_count(self):
        return len(self.roots())
 
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
 
    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

def main():
    N, M = map(int, input().split())
    uf = UnionFind(N+1)

    for i in range(M):
        A, B = map(int, input().split())
        uf.union(A, B)
    # print(uf.all_group_members())
    # print(uf.parents)
    ans = -min(uf.parents)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 79384
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var g=sc.Ia2;
		var a=sc.Ia2;
		var b=new bool[s[0]+1];
		long ans=a[1];
		for(int i = 1;i<=s[0];i++) {
			int p=i;
			if(b[p]){continue;}
			long d=0,f=0;
			var li=new List<long>();
			while(!b[p]){
				b[p]=true;
				d+=a[p];
				li.Add(a[p]);
				p=g[p];
			}
			int k=s[1];
			int m=li.Count;
			if(k>=li.Count&&d>0){
				f=d*(k/li.Count);
				k%=li.Count;
				ans=Max(f,ans);
			}
			li.AddRange(li);
			for(int j = 0;j<m;j++) {
				long z=0;
				for(int l = j;l<j+k&&l<li.Count;l++) {
					z+=li[l];
					ans=Max(ans,f+z);
				}
			}
			if(s[1]>=m&&d>0){
				f=d*(s[1]/m-1);
				k+=m;
				for(int j = 0;j<m;j++) {
					long z=0;
					for(int l = j;l<j+k&&l<li.Count;l++) {
						z+=li[l];
						ans=Max(ans,f+z);
					}
				}
			}
		}
		Console.WriteLine(ans);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 29368
#include <bits/stdc++.h>
const long long INF = LLONG_MAX / 2;
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i, r, n) for(int i=(ll)(r); i<(ll)(n); i++) 
#define REP(i, n) FOR(i, (0), n)
#define ALL(r) r.begin(), r.end()
#define ll long long int
using namespace std;
string s;
vector<ll> v;
vector<pair<ll, ll>> vp;
vector<vector<ll>> vv(110, vector<ll>(50, 0));
vector<tuple<ll, ll, ll>> vt;
set<ll> st;
map<char, ll> mp;

typedef int Weight;
struct Edge
{
	int from, to; Weight cost;
	bool operator < (const Edge& e) const { return cost < e.cost; }
	bool operator > (const Edge& e) const { return cost > e.cost; }
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph &g, int from, int to, Weight cost)
{
	g[from].push_back(Edge{ from, to, cost });
}

Weight dist[100005];
typedef pair<Weight, Edge> P;

int n, m;
ll ans=0;
bool d[10][10];

void solve(int num,int dep, int b)
{
	if (dep >= n) ans++;
	else
	{
		FOR(i,1,n+1)
		{
			auto visited = [b](int k) {return b + (1 << k); };
			if (i != num&&d[num][i]&&!((b >> i) & 1)) solve(i, dep + 1, visited(i));
		}
	}
}

int main()
{

	cin >> n >> m;
	REP(i,m)
	{
		ll a, b;
		cin >> a >> b;
		d[a][b] = d[b][a] = true;
	}
	solve(1, 1, 2);
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input().strip())
arr = list(map(int, input().rstrip().split()))
d=[0]*n
d[0]=0
d[1]=abs(arr[0]-arr[1])
a=abs
for i in range (2,n):
    d[i]=min(d[i-1]+a(arr[i]-arr[i-1]),d[i-2]+a(arr[i]-arr[i-2]))
print(d[n-1])


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


def solve(N: int, a: "List[int]"):
    a = list(reversed(sorted(a)))
    alice = [a_[1] for a_ in enumerate(a) if a_[0] % 2 == 0]
    bob = [a_[1] for a_ in enumerate(a) if a_[0] % 2 == 1]
    # print(alice, bob)
    print(sum(alice) - sum(bob))
    return


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
#define ll long long
#define INF 0x3f3f3f3f
#define N 1005
using namespace std;



int main()
{
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[1]==s[2]||s[1]==s[2]&&s[2]==s[3]||s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3])
	puts("Yes");
	else
	puts("No");
	return 0;
}

Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = sorted(LI())
    b = sorted(LI())
    c = sorted(LI())
    t = [0] * n
    j = 0
    for i in range(n):
        bi = b[i]
        while j < n and c[j] <= bi:
            j += 1
        t[i] = n - j
    r = 0
    for i in range(n-2,-1,-1):
        t[i] += t[i+1]
    j = 0
    for i in range(n):
        ai = a[i]
        while j < n and b[j] <= ai:
            j += 1
        if j < n:
            r += t[j]

    return r



print(main())




Measured memory_bytes: 26348
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int h,w,k;
    cin>>h>>w>>k;
    vector<string> g(h);
    rep(i,h){
        cin>>g[i];
    }
    int ans=0;
    rep(S,1<<h)rep(T,1<<w){
        vector<string> now(g);
        rep(i,h){
            if(S & (1<<i)){
                rep(j,w){
                    now[i][j]='.';
                }
            }
        }
        rep(j,w){
            if(T & (1<<j)){
                rep(i,h){
                    now[i][j]='.';
                }
            }
        }
        int cnt=0;
        rep(i,h)rep(j,w) if(now[i][j]=='#') cnt++;
        if(cnt==k) ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mpair make_pair
#define pm(first, second) pb(mpair(first, second))
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()
#define rall(X) (X).rbegin(), (X).rend()
#define divcel(a, b) (((a) + ((b) - 1)) / (b))

int main(){

	ll a, b;
	cin >> a >> b;
	if((a+b)%2 == 0){
		cout << (a+b)/2 << endl;
	}
	else{
		cout << "IMPOSSIBLE" << endl;
	}

	return 0;
}


Measured memory_bytes: 3624
n = gets.to_i
p = []
n.times{ p << gets.split.map(&:to_i) }
sum = 0
c = p.pop
p.each_cons(2){ |a,b|
    sum += 0.5 * (a[0] * b[1] + b[0] * c[1] + c[0] * a[1] - b[0] * a[1] - c[0] * b[1] - a[0] * c[1])
}
puts sum.abs


Measured memory_bytes: 6884
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<functional>
#include<queue>
#include<map>
#include<cmath>
#include<tuple>
#include<algorithm>
#include<bitset>
#include<utility>
#include<complex>
#include<cstdlib>
#include<set>
#include<cctype>

#define DBG cerr << '!' << endl;
#define REP(i,n) for(int (i) = (0);(i) < (n);++i)
#define rep(i,s,g) for(int (i) = (s);(i) < (g);++i)
#define rrep(i,s,g) for(int (i) = (s);i >= (g);--(i))
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int i = 0;i < (n);i++)cerr << v[i] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int a = 0;a < i;a++){for(int b = 0;b < j;b++)cerr << v[a][b] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()

using namespace std;

typedef long long ll;
typedef vector<int> iv;
typedef vector<iv> iiv;
typedef vector<string> sv;

int main()
{
	int a,b,c,ans;
	cin >> a >> b >> c;
	
	if(a != b)
	{
		if(a != c)
		{
			ans = a;
		}
		else
		{
			ans = b;
		}
	}
	else
	{
		ans = c;
	}
	
	cout << ans << endl;
	
	
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    int a[n];
    int b[n];
    int c[n-1];

    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    rep(i, n-1) cin >> c[i];

    int ans = 0;
    rep(i, n) ans += b[i];
    rep(i, n - 1) {
        if (a[i] == a[i + 1] - 1) {
            ans += c[a[i] - 1];
        }
    }

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


Measured memory_bytes: 256
/*****************************************************************************************
******************************AUTHOR:***************************************************
****************************ASHISH RANJAN***********************************************
*****************************************************************************************/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<chrono>
#include<vector>
#include<string>
using namespace std;
using namespace std::chrono;
/*
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    cout << "Time taken by function: "
         << duration.count() << " microseconds" << endl;
*/
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define mod 1000000007
#define fr(i,n) for(int i=0;i<(int)n;i++)
int main(){
  fast();
  vector<char> v;
string s;
cin>>s;
int n = s.size();
fr(i,n){
if(s[i]=='0'||s[i]=='1')v.push_back(s[i]);
  if(s[i]=='B'&&!v.empty())v.pop_back();
}
for(auto i:v)cout<<i;
 return 0;
  
}


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


int main(){
    int H,W;
    while(1) {
        cin >> H >> W;
        if (H == 0 && W == 0) break;
        for (int i = 0; i < H ; i++){
            for ( int j = 0; j < W; j++ ){
                if ( (i + j)%2 == 0){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
         return 0;
}

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

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

	int ans = 0;
	for (int i = 0; i < n; i++) {
		int l, r;
		cin >> l >> r;
		ans += r - l + 1;
	}

	cout << ans << endl;

	return 0;
}

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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
// #define DEBUG


unsigned long long getint(int x[], int n){
    unsigned long long ret = 0;
    unsigned long long p[n];
    rep(i, n)
        p[i] = 1ll << i;
    rep(i, n)
        ret += x[i] * p[i];
    return ret;
}

int bitcount(int x[], int n){
    int ret = 0;
    rep(i, n)
        ret += x[i];
    return ret;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif
    const int b = 64;
    int q, x, y, bits[b];
    fill(bits, bits + b, 0);
    cin >> q;
    rep(i, q)
    {
        cin >> x;
        if (x == 0)
        {
            cin >> y;
            cout << bits[y] << endl;
        }
        else if (x == 1)
        {
            cin >> y;
            bits[y] = 1;
        }
        else if (x == 2)
        {
            cin >> y;
            bits[y] = 0;
        }
        else if (x == 3)
        {
            cin >> y;
            bits[y] = 1 - bits[y];
        }
        else if (x == 4)
        {
            cout << ( (bitcount(bits, b) == b) ? 1 : 0 ) << endl;
        }
        else if (x == 5)
        {
            cout << ( (bitcount(bits, b) > 0) ? 1 : 0 ) << endl;
        }
        else if (x == 6)
        {
            cout << ( (bitcount(bits, b) == 0) ? 1 : 0 ) << endl;
        }
        else if (x == 7)
        {
            cout << bitcount(bits, b) << endl;
        }
        else if (x == 8)
        {
            printf( "%llu\n", getint(bits, b) );
        }
    }

    return 0;
}



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

int main(){
    int M1,D1,M2,D2;
    cin>>M1>>D1>>M2>>D2;

    if(D1==31&&D2==1){
        cout<<1<<endl;
        return 0;
    }else if(D1==30&&D2==1){
        cout<<1<<endl;
        return 0;
    }else if(D1==28&&D2==1){
        cout<<1<<endl;
        return 0;
    }else cout<<0<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;
const int IINF = 1e9;
const ll INF = 1e18;
const int MOD = 1e9 + 7;

#define dump(x) cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl

void chmin(ll &a, ll b) {
  if (a > b) {
    a = b;
  }
}
void chmax(ll &a, ll b) {
  if (a < b) {
    a = b;
  }
}

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

  if (H == 1 || W == 1) {
    cout << 1 << endl;
    return 0;
  }

  cout << ((W + 1) / 2) * ((H + 1) / 2) + (W / 2) * (H / 2) << endl;
}

Measured memory_bytes: 256
import math

if __name__ == '__main__':

	#入力
	N = int(input())
	ans = 11

	ref = int(math.sqrt(N)) + 1

	for i in range(1,ref):
		if N % (ref - i) == 0:
			bigger_one = max(i, int(N/(ref-i)))
			keta = int(math.log10(bigger_one)) + 1
			ans = keta
			break

	print(ans)

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

int main(){
  int a,b; cin >> a >> b;
  int ans=0;
  if(a>=13) ans=b;
  else if(a>=6) ans=b/2; 
  cout << ans << endl;
 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
  string S;
  cin >> S;

  int count = 0;
  for(int i=0; i < S.length(); ++i){
    S[i] == '+'? ++count : --count;
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
void solve(int N) {

}
int main(void) {
  long N;
  std::cin >> N;
  long accum = 0;
  for (long i = 1; i < N; i++)
  {
    accum += i;
  }
  std::cout << accum << std::endl;
  solve(N);
  return 0;
}


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


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

int main(){
    int N, A, i, max, second;

    cin >> N;
    int ptr[N];
    vector<int> array(N);
    for(i = 0; i < N; i++){
        cin >> A;
        ptr[i] = A;
        array[i] = A;
    }
    sort(array.begin(), array.end());
    max = array[N-1];
    second = array[N-2];
    for(i = 0; i < N; i++){
        if(ptr[i] == max){
            cout << second << endl;
        }else{
            cout << max << endl;
        }
    }
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
#define ll long long
#define M 1000000007 
#define MM 998244353
#define PI 3.14159265 
using namespace std;
 
int main()
{
	string s, t;
	cin >> s >> t;
	int ans = t.size();

	for (int i = 0; i < s.size()-t.size()+1; i++)
	{
		int counter = 0;
		for (int j = 0; j < t.size(); j++)
		{
			if (s[i+j] == t[j])
			{
				counter++;
			}
		}
		ans = min (ans, (int)t.size()-counter);
	}

	cout << ans;

  	return 0;
}

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

int main(){
    int N, K;    
    string S;
    cin >> N;
    cin >> S;
    cin >> K;        
    for(int i=0; i<N; i++){
	if(S[K-1] != S[i])
	    S[i] = '*';
    }
    
    cout << S << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
using namespace std;
 
int main(){
  int n;
 
  while(1) {
  cin >> n;
  if(n == 0) break;
  vector <int> v,lo;
 
  string str[10];
  v.resize(n);
  lo.resize(n);
  for(int i=0;i<n;i++) v[i] = lo[i] = 0;
   
  int a;
  for(int i=0;i<n;i++) {
    cin >> str[i];
    for(int j=0;j<n-1;j++) {
      cin >> a;
      if(a ==0) v[i]++;
      else if(a == 1) lo[i]++;
       
    }
  }
   
  string t;
 
  for(int i=0;i<n-1;i++) {
    for(int j=n-1;j>i;j--) {
      if(v[j] > v[j-1]) {
    t = str[j];
    str[j] = str[j-1];
    str[j-1]  = t;
     
    a = v[j];
    v[j] = v[j-1];
    v[j-1] = a;
     
    a = lo[j];
    lo[j] = lo[j-1];
    lo[j-1] = a;
     
      } else if(v[j] == v[j-1] && lo[j] < lo[j-1]) {
    t = str[j];
    str[j] = str[j-1];
    str[j-1] = t;
 
    a = lo[j];
    lo[j] = lo[j-1];
    lo[j-1] = a;
      }
    }
  }
      for(int i=0;i<n;i++) cout << str[i] << endl;
 
  } 
 
 
  return 0;
}

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

#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

signed main(){
	fastio
	int x,k,d;
	cin >> x >> k >> d;
	x = abs(x);
	if(k<=x/d){
		cout << -k*d+x << "\n";
		return 0;
	}
	int val1 = x-(x/d)*d, val2 = abs(val1-d);
	//cout << val1 << " " << val2 << "\n";
	k-=x/d;
	if(k&1) cout << val2 << "\n";
	else cout << val1 << '\n';
}

Measured memory_bytes: 3684
g = p = w = l = 0
gets.chomp.split(//).each do |e|
    case e
    when 'g'
        if g > p
            p += 1
            w += 1
        else
            g += 1
        end
    when 'p'
        if g > p
            p += 1
        else
            l += 1
            g += 1
        end
    end
end
p w - l

Measured memory_bytes: 6908
import sys
from collections import deque
n = int(sys.stdin.readline())
q = deque()
for i in range(n):
    c = sys.stdin.readline()[:-1]
    if c[0] == 'i':
        q.appendleft(c[7:])
    elif c[6] == ' ':
        try:
            q.remove(c[7:])
        except:
            pass
    elif c[6] == 'F':
        q.popleft()
    else:
        q.pop()
print(*q)

Measured memory_bytes: 71924
#include<bits/stdc++.h>
using namespace std;
#define max1 100005
#define siz 100000
#define mod 1000000007
#define inf 1e18+5
#define ll long long int
#define debug(x) cout<<#x<<" "<<x<<endl
#define jam(x) cout<<"Case #"<<x<<": "
typedef pair<ll,ll> pr;
vector<vector<ll> > dp(max1,vector<ll>(2,-1));
vector<ll> a(max1);
ll n,k;
ll fun(ll k,ll x)
{
  //cout<<k<<" "<<x<<endl;
  if(k<0)
  {
    return x;
  }
  if(dp[k][x]!=-1)
  {
    return dp[k][x];
  }
  ll cnt=x^1;
  for(ll i=0;i<n;i++)
  {
    ll y;
    y=fun(k-a[i],x^1);
    if(y==x)
    {
      cnt=x;
    }
  }
  //cout<<k<<" "<<x<<" "<<cnt<<endl;
  return dp[k][x]=cnt;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  /*#ifndef ONLINE_JUDGE
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  #endif*/
  cin>>n>>k;
  for(ll i=0;i<n;i++)
  {
    cin>>a[i];
  }
  ll ans=fun(k,0);
  if(ans==0)
  {
    cout<<"First\n";
  }
  else
  {
    cout<<"Second\n";
  }
}

Measured memory_bytes: 14336
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
 
using namespace std;
 
#define MAX_N 50
#define MAX 50001
#define INF 1e9
int n, c[MAX_N];
 
int getNum(){
    int cost[MAX];
 
    memset(cost,0,sizeof(cost));
    cost[0] = 1;
    for(int i = 0 ; i < n ; i++){
	for(int j = 0 ; j < MAX-c[i] ; j++){
	    cost[c[i]+j] += cost[j];
	}
    }
 
    for(int i = 0 ; i < MAX ; i++){
	if(cost[i] == 0){
	    return 1;
	}
    }
 
    fill(cost,cost+MAX,INF);
    cost[0] = 0;
    for(int i = 0 ; i < n ; i++){
	for(int j = c[i] ; j < MAX ; j++){
	    cost[j] = min(cost[j], cost[j-c[i]]+ 1);
	}
    }
 
    int s = MAX-1;
    for(int i = s ; i >= 1 ; i--){
	int rem = i, cnt = 0;
	for(int j = n-1 ; j >= 0 ; j--){
	    if(rem >= c[j]){
		cnt += rem / c[j];
		rem %= c[j];
	    }
	}
	if(cost[i] != cnt){
	    return 2;
	}
    }
 
    return 3;
}
 
int main(){
    int Tc = 1;
 
    while(scanf("%d" ,&n), n){
	for(int i = 0 ; i < n ; i++){
	    scanf("%d" , c+i);
	}
	int num = getNum();
	printf("Case #%d: " ,Tc++);
	if(num == 1){
	    puts("Cannot pay some amount");
	}else if(num == 2){
	    puts("Cannot use greedy algorithm");
	}else{
	    puts("OK");
	}
    }
    return 0;
}

Measured memory_bytes: 3376
#include<stdio.h>
int main()
{
    int n,x,i,j,k,total;
    while(1)
    {
        scanf("%d %d",&n,&x);
        total = 0;
        if(n==0 && x==0)
        {
            return 0;
        }
        else
        {
            for(i=1;i<n-1;i++)
            {
                for(j=i+1;j<n;j++)
                {
                    for(k=j+1;k<n+1;k++)
                    {
                        if(i+j+k==x)
                        {
                            total++;
                        }
                    }
                }
            }
            printf("%d\n",total);
        }
    }
    return 0;
}



Measured memory_bytes: 2068
#include<stdio.h>
#define N 10
typedef unsigned long long int INT;
INT GCD(INT a, INT b){
	if( b == 0 ) return a;
	else return GCD(b,a%b);
}
INT LCM(INT a, INT b){
	return (a/GCD(a,b))*b;
}
int main(){
	while(1){
		int i,n;
		INT d[N];
		INT v[N];
		INT Ans[N];
		INT lcmD = 1;
		INT gcdAns = 1;

		scanf("%d",&n);
		if(0==n)break;

		for(i = 0; i < n; ++i){
			int td, tv;
			int gcd;
			scanf("%d%d",&td,&tv);
			gcd = GCD(td,tv);
			d[i] = (INT)td/gcd;
			v[i] = (INT)tv/gcd;
		}
		
		lcmD = LCM( d[0], d[1] );
		for(i = 2; i < n; ++i){
			lcmD = LCM( lcmD, d[i] );
		}
		for(i = 0; i < n; ++i){
			Ans[i] = (lcmD / d[i])*v[i];
		}
		gcdAns = GCD( Ans[0], Ans[1] );
		for(i = 2; i < n; ++i){
			gcdAns = GCD( gcdAns, Ans[i] );
		}
		for(i = 0; i < n; ++i){
			Ans[i] /= gcdAns;
		}
		for(i = 0; i < n; ++i){
			printf("%u\n", (unsigned int)(Ans[i]));
		}
	}
	return 0;
}

Measured memory_bytes: 0
x, y = map(int, input().split())

set1 = [1, 3, 5, 7, 8, 10, 12]
set2 = [4, 6, 9, 11]
set3 = [2]


if x in set1:
    if y in set1:
        print('Yes')
    else:
        print('No')
elif x in set2:
    if y in set2:
        print('Yes')
    else:
        print('No')
elif x == 2:
    if y == 2:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 3060
#include<stdio.h>

int main()
{
    int e=0,o=0,n;
    scanf("%d",&n);
    int i;
    for(i=1;i<=n;i++)
    {
    if(i%2==0){
    e++;
    }
    else{
    o++;
    }


    }
    printf("%d\n",e*o);



return 0;
}


Measured memory_bytes: 128
n = gets.chomp.to_i
l = []
n.times do |num|
  l << gets.chomp.to_i
end
m = 1000000000000
d = -1000000000000
l.each do |i|
  n = i.to_i
  a = n - m 
  d = a if a > d
  m = n if m > n 
end
p d

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

constexpr int INF = 1e9;

int main() {
    int N;
    cin >> N;
    vector<pair<int, int>> stamp;
    constexpr char color[] = {'R', 'G', 'B'};
    vector<int> h(N), w(N);
    for(int i=0; i<N; ++i) {
        cin >> h[i] >> w[i];
    }

    string g;
    for(int i=0; i<16; ++i) {
        char c;
        cin >> c;
        g += c;
    }

    for(int i=0; i<N; ++i) {
        for(int y=-h[i]+1; y<4; ++y) {
            for(int x=-w[i]+1; x<4; ++x) {
                for(int c=0; c<3; ++c) {
                    int flag1 = (1 << 16) - 1;
                    int flag2 = 0;
                    for(int k=0; k<h[i]; ++k) {
                        for(int l=0; l<w[i]; ++l) {
                            int yy = (y+k)*4, xx = x+l;
                            if(yy < 0 && 16 <= yy || xx < 0 || 4 <= xx || 16 <= yy+xx) {
                                continue;
                            }
                            if(color[c] == g[yy+xx]) {
                                flag2 |= (1 << (yy+xx));
                            } else {
                                flag1 &= ~(1 << (yy+xx));
                            }
                        }
                    }
                    stamp.push_back(make_pair(flag1, flag2));
                }
            }
        }
    }
    sort(stamp.begin(), stamp.end());
    stamp.erase(unique(stamp.begin(), stamp.end()), stamp.end());

    queue<int> que;
    vector<int> dp(1 << 16, INF);
    dp[0] = 0;
    que.push(0);
    while(!que.empty()) {
        int now = que.front();
        que.pop();
        for(auto& s : stamp) {
            int next = (now & s.first) | s.second;
            if(dp[next] == INF) {
                dp[next] = dp[now] + 1;
                que.push(next);
            }
        }
    }
    cout << dp[(1 << 16) - 1] << endl;
}


Measured memory_bytes: 3464
n,t=map(int,input(). split())
a = [[int(j) for j in input().split()] for i in range(n)]
a=sorted(a)
z=True
for i in range(n) :
    if a[i][1]<=t :
        print(a[i][0])
        z=False
        break
if  z  :
    print("TLE")

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

int main(void){

    int n;
    cin>>n;
    string a[100000];
    long long int b[5]={0};
    long long int sum=0;

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

    for(int i=0;i<n;i++){
        if(a[i][0]=='M')b[0]++;
        if(a[i][0]=='A')b[1]++;
        if(a[i][0]=='R')b[2]++;
        if(a[i][0]=='C')b[3]++;
        if(a[i][0]=='H')b[4]++;
    }
   /* for(int i=0;i<5;i++){
        cout<<b[i]<<" ";
    }*/

    for(int i=0;i<5;i++){
        for(int j=i+1;j<5;j++){
            for(int k=j+1;k<5;k++){
                sum+=b[i]*b[j]*b[k];
             //   cout<<sum<<" ";
            }
        }
    }
    cout<<sum<<endl;

}

Measured memory_bytes: 6144
n, m = map(int, input().split())
a = [0 for _ in range(n + 1)]
for i in range(m):
    A = int(input())
    a[A] = 1

tmp = [0 for _ in range(n + 1)]
tmp[0] = 1

for i in range(1, n + 1):
    if a[i] == 1:
        tmp[i] = 0
    else:
        if i - 2 >= 0:
            tmp[i] += tmp[i - 2]
        if i - 1 >= 0:
            tmp[i] += tmp[i - 1]
        tmp[i] %= 1000000007


print(tmp[-1] % 1000000007)

Measured memory_bytes: 50848
#include <bits/stdc++.h>  // clang-format off
using namespace std;
using Int = long long;
#define REP2(i, n) for (Int i = 0, max_i = (n); i < max_i; i++)
#define REP3(i, a, b) for (Int i = (a), max_i = (b); i < max_i; i++)
#define OVERLOAD2(_1, _2, _3, name, ...) name
#define REP(...) OVERLOAD2(__VA_ARGS__, REP3, REP2)(__VA_ARGS__)
struct SetupIO { SetupIO() { cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(13); } } setup_io;
#ifndef _MY_DEBUG
#define dump(...)
#endif  // clang-format on

/**
 *    author:  knshnb
 *    created: Mon Feb 10 22:50:13 JST 2020
 **/

signed main() {
    Int H, n;
    cin >> H >> n;
    Int sum = 0;
    REP(i, n) {
        Int x; cin >> x;
        sum += x;
    }
    cout << (sum >= H ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#pragma region

#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define _rep3(i, begin, end) for (register int i = (begin); i < (end); i++)
#define _irep3(i, begin, end) for (register int i = (end)-1; i >= (begin); i--)
#define _rep2(i, n) _rep3(i, 0, n)
#define _irep2(i, n) _irep3(i, 0, n)
#define _overload3(_1, _2, _3, name, ...) name
#define rep(...) _overload3(__VA_ARGS__, _rep3, _rep2, )(__VA_ARGS__)
#define irep(...) _overload3(__VA_ARGS__, _irep3, _irep2, )(__VA_ARGS__)
#define out(x) cout << (x) << '\n';
#define debug(x) cerr << #x << " = " << (x) << " (line: " << __LINE__ << ") " << endl;
typedef long long ll;

template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (auto &v : vec) is >> v;
  return is;
}

#pragma endregion

#define MOD 1000000007
#define INF 2147483647

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

  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;

  out(e - a <= k ? "Yay!" : ":(");
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

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

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

func main() {
	sc.Split(bufio.ScanWords)
	n := next()
	ans := 0
	for _, v := range n {
		ans += int(v - '0')
	}
	fmt.Println(ans)

}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int k=scan.nextInt();
		scan.close();
		int num[]= {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

		System.out.println(num[k-1]);
	}

}


Measured memory_bytes: 21972