akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define yes "Yes"
#define yse "Yes"
#define no "No"

#define pb push_back
#define rep(i, l, n) for (int i = (l); i < n; i++)
#define rep_cs(i, l, n) for (int i = (l); i <= n; i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}

const int MOD = 1000000007;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(v.begin(), v.end());
// int sum = accumulate(v, v + v.size(), 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

using Graph = vector<vector<int>>;
Graph G;
vector<bool> seen;
void dfs(const Graph &G, int v)
{
    seen[v] = true;

    for (auto next_v : G[v])
    {
        if (seen[next_v])
            continue;
        dfs(G, next_v);
    }
}

int main()
{
    vll v(3);
    rep(i, 0, 3) cin >> v[i];

    int odd = 0, even = 0;
    rep(i, 0, 3)
    {
        if (v[i] % 2 == 0)
            even++;
        else
            odd++;
    }

    int ans = 0;

    if (odd == 2)
    {
        ans++;
        rep(i, 0, 3) if (v[i] % 2 == 1) v[i]++;
    }
    else if (even == 2)
    {
        ans++;
        rep(i, 0, 3) if (v[i] % 2 == 0) v[i]++;
    }

    int ma = max(v[0], max(v[1], v[2]));
    rep(i, 0, 3) ans += (ma - v[i]) / 2;
    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int n;
ll a[125252];
vi g[125252];

ll dfs(int p,int bef){
  if(g[p].size()==1)return a[p];
  ll nd = a[p];
  ll sum = 0;
  ll mx = 0;
  for(int to : g[p])if(to!=bef){
    ll po = dfs(to,p);
    sum += po;
    CHMAX(mx,po);
  }
  ll sa = sum-nd;
  nd -= sa;
  ll cansub = sum/2;
  if(mx > cansub){
    cansub = sum - mx;
  }
  if(sa>cansub || sa<0 || nd<0){
    puts("NO");
    exit(0);
  }
  return nd;
}

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%lld",a+i);
  REP(i,n-1){
    int u,v;
    scanf("%d%d",&u,&v);
    --u;--v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  if(n==2){
    puts(a[0]==a[1]?"YES":"NO");
    return 0;
  }
  int from = 0;
  REP(i,n)if(g[i].size()>1){
    from = i;
    break;
  }
  ll ans = dfs(from,-1);
  puts(ans==0 ? "YES" : "NO");
  return 0;
}


Measured memory_bytes: 13696
#include<stdio.h>
int main()
{
    int m,n,k;
    scanf("%d %d %d",&m,&n,&k);
    for(int i=0;i<k;i++)
    {
    	if(i%2==0)
    	{
    		m=m/2;
    		n=n+m;
		}
		else
		{
			n=n/2;
			m=m+n;
		}
	}
	printf("%d %d\n",m,n); 
    return 0;
}

Measured memory_bytes: 128
#define _USE_MATH_DEFIMES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1'000'000'007;
const int INF = 1'000'000'000; //1e9
const int NIL = -1;
const long long LINF = 1'000'000'000'000'000'000; // 1e18
const long double EPS = 1E-10;

template<class T, class S> inline bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S> inline bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}








int main(){
    int N, cnt(0); std::cin >> N;
    std::vector<int> L(N);
    for(int i(0); i < N; ++i) std::cin >> L[i];
    for(int i(0); i < N; ++i){
        for(int j(i+1); j < N; ++j){
            if(L[i] == L[j]) continue;
            for(int k(j+1); k < N; ++k){
                if(L[i] == L[k] || L[j] == L[k]) continue;
                if(std::abs(L[i]-L[j]) < L[k] && L[k] < L[i] + L[j])
                    ++cnt;
            }
        }
    }
    std::cout << cnt << std::endl;
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  long long n,k;
  cin >> n >> k;
  long long u[n];
  rep(i,n)cin >> u[i];
  long long p=1000000007;
  long long r[n];
  long long m[n];
  rep(i,n){
    r[i]=0;
    m[i]=0;
  }
  rep(i,n){
    long long h=u[i];
    for(int j=i+1;j<n;j++){
      if(u[j]<h){
        r[j]++;
        m[j]++;
      }
    }
    rep(j,i){
      if(u[j]<h){
        m[j]++;
      }
    }
  }
  long long ans=0;
  rep(i,n){
    ans=(ans+r[i]*k+((k*(k-1)/2)%p)*m[i])%p;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using intpair=pair<int,int>;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define PI 3.141592653589793
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define INTINF 1<<30
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )
#define gsort(vbeg,vend) sort(vbeg,vend,greater<>())

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

ll gcd(ll a, ll b) { //最大公約数
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll factorial(ll x) { //階乗
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {
	if (n == r) { return 1; }
	if (r > n) { return 0; }

	if (r > n / 2) { r = n - r; }

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) { //にぶたんgreater
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int DigitNum(ll n) { //桁数
	int digit=0;
	ll wari=1LL;
	while(n/wari) {
		digit++;
		wari*=10;
	}
	return digit;
}

bool IsPrime(ll num) { //素数判定
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

vector<ll> Divisor(ll x) { // 約数列挙
	vector<ll> result;
	ll i=1LL;
	for( ; i*i<x; i++) {
		if(x%i) continue;
		result.push_back(i);
		result.push_back(x/i);
	}
	if(i*i==x&&!x%i)
		result.push_back(i);
	
	sort(result.begin(),result.end());
	return result;
}

vector<llpair> PrimeFact(ll x) { // 素因数分解 {素因数,指数}
	vector<llpair> result;
	ll ex=0LL;
	if(x%2==0) {
		while(x%2==0) {
			x/=2;
			ex++;
		}
		result.push_back({2,ex});
	}

	for(ll i=3LL; i*i<=x; i+=2) {
		if(x%i) continue;

		ex=0LL;
		while(x%i==0) {
			x/=i;
			ex++;
		}
		result.push_back({i,ex});
	}

	if(x!=1) result.push_back({x,1});

	return result;
}

bool Palind(string s) { //回文判定
	return s == string(s.rbegin(), s.rend());
}

int main() {
	int N; cin>>N;
	ll A[N]; for(int i=0; i<N; i++) cin>>A[i];
	sort(A,A+N);

	ll sum[N];
	sum[0]=A[0];
	for(int i=1; i<N; i++)
		sum[i]=sum[i-1]+A[i];

	int result=1; // 最初の時点で最大生物は生存可
	for(int i=N-2; i>=0; i--) {
		if(2*sum[i]>=A[i+1]) // 自分より小さい生物を吸収して自分より上の生物を吸収できれば生存可
			result++;
		else
			break;
	}

	cout<<result<<endl;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

const int MOD=1000000007;
int INF=100100100100100;
int a[200010];
signed main(){
  int n;cin>>n;
  rep(i,n)cin>>a[i];
  sort(a,a+n);
  string ans="YES";
  rep(i,n-1){
    if(a[i]==a[i+1]){
      ans="NO";
      break;
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<string>
#include<cmath>
#include<iterator>
using namespace std;

#define rep(i,j,n) for(int (i)=(j);(i)<(n);i++)
#define rep2(i,j,n) for(int (i)=(j);(i)<=(n);i++)
#define all(i) (i).begin(),(i).end()

typedef long long i64;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;

int main(){
    int n;
    cin>>n;
    vector<i64> l(n+1);
    l[0]=2;
    l[1]=1;
    rep2(i,2,n){
        l[i]=l[i-1]+l[i-2];
    }
    cout<<l[n]<<endl;
}


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

int sumof(int n){
  int sum = 0;

  while(n > 0){
    sum += n % 10;
    n /= 10;
  }
  return sum;
}

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

  num = sumof(N);

  if(N % num == 0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MIN -1000000
using namespace std;
typedef long long ll;
typedef pair <int,int> pii;
bool visited[100005];
const int max_N=1e5+10;
int N,Q;
string s;
int cnt[100005];
int mxindex,mxchain=0;
int main(void)
{
  cin >> N >> Q;
  cin >> s;
  bool Appear=false;
  int acnum=0;
  for (int i = 0; i < int(s.size()); ++i)
    {
      if(s[i]=='A')
	{
	  Appear=true;
	}
      else
	{
	  if(Appear)
	    {
	      if(s[i]=='C')
		{
		  acnum++;
		  Appear=false;
		}
	      else
		{
		  if(s[i]!='A')
		    {
		      Appear=false;
		    }
		}
	    }
	}
      cnt[i]=acnum;
    }
  for(int i=0;i<Q;i++)
    {
      int l,r;
      cin >> l >> r;
      cout << cnt[r-1]-cnt[l-1] << endl;
    }
  return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  vector<int> c(4, 0);
  for (int i=0; i<n; i++) {
    cin >> s;
    if (s=="AC") c[0]++;
    if (s=="WA") c[1]++;
    if (s=="TLE") c[2]++;
    if (s=="RE") c[3]++;
  }
  cout << "AC x " << c[0] << endl;
  cout << "WA x " << c[1] << endl;
  cout << "TLE x " << c[2] << endl;
  cout << "RE x " << c[3] << endl;
}

Measured memory_bytes: 3224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    int a, b;
    cin >> a >> b;
    string s = (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)? "Possible" : "Impossible";
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 256
n=int(input())
s=input()

patterns=[("S","W"),("W","S"),("S","S"),("W","W")]

def solve(pattern):
  l=[True]*n
  l[0],l[1]=pattern
  for i in range(1,n-1):
    if (s[i]=="o" and l[i]=="S") or (s[i]=="x" and l[i]=="W"):
      l[i+1]=l[i-1]
    else:
      if l[i-1]=="S":
        l[i+1]="W"
      else:
        l[i+1]="S"
  if (s[-1]=="o" and l[-1]=="S") or (s[-1]=="x" and l[-1]=="W"):
    va=(l[-2]==l[0])
  else:
    va=(l[-2]!=l[0])
  if (s[0]=="o" and l[0]=="S") or (s[0]=="x" and l[0]=="W"):
    vb=(l[1]==l[-1])
  else:
    vb=(l[1]!=l[-1])
  return va&vb,l

for pattern in patterns:
  res,string=solve(pattern)
  if res:
    print(*string,sep="")
    break
else:
  print(-1)

Measured memory_bytes: 7636
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include<iostream>
#include<queue>
using namespace std;
int a,b,ans;
int main()
{
	cin>>a>>b;
	ans=a+b;
	if(b==0)
		cout<<a<<"\n";
		
	else if(ans>23)
		cout<<ans-24<<"\n";

	else
		cout<<ans<<"\n";
		

	
	
	

	return 0;
}



Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > //第二成分の大きさが関係ない
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}

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


  ll N;
  cin >> N;
  
  ll a = 0 ; 
  ll b = 0;
  a = N ; 
  
  while(N!=0){
    b += N%10;
    N/=10;
  }
  
  if(a%b == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}






Measured memory_bytes: 256
# coding: utf-8
import sys
from collections import deque

output_str = deque()
data_cnt =  int(input())  

for i in range(data_cnt):
    in_command = sys.stdin.readline().rstrip().split(" ")
    if in_command[0] == "insert":
        output_str.appendleft(in_command[1])
    elif in_command[0] == "delete":
        if output_str.count(in_command[1]) > 0:
            output_str.remove(in_command[1])
    elif in_command[0] == "deleteFirst":
        output_str.popleft()
    elif in_command[0] == "deleteLast": 
        output_str.pop()

print(" ".join(output_str))

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

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		
		Arrays.sort(A);
		int count = 1;
		int check = 0;
		int[] num = new int[N];
		
		for(int i = 1; i < N; i++) {
			if(A[i] == A[i - 1]) {
				count++;
				if(i == N - 1) {
					num[check] = count;
				}
			} else {
				if(i == N - 1) {
					num[check] = count;
					num[check + 1] = 1;
				} else {
					num[check] = count;
					count = 1;
					check++;
				}
			}
		}
		
		int len = 0;
		int[] num2 = new int[N];
		Arrays.sort(num);
		int y = 0;
		
		for(int i = 0; i < N; i++) {
			if(num[i] != 0) {
				len++;
				num2[y] = num[i];
				y++;
			}
		}
		
		if(N == 1) {
			System.out.println(0);
		} else {
			if(len <= K) {
				System.out.println(0);
			} else {
				int sum = 0;
				int x = 0;
				while(len - x > K) {
					sum += num2[x];
					x++;
				}
				System.out.println(sum);
			}
		}
	}
}


Measured memory_bytes: 89912
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    string s="";
    while(n>0){
        bool jud=false;
        int x=(n%26);x--;
        char c=x+'a';
        if(x==-1){
            c='z';
            jud=true;
        }
        s.push_back(c);
        n/=26;
        if(jud)n--;
    }
    reverse(s.begin(),s.end());
    cout<<s<<endl;
}


Measured memory_bytes: 3628
n = int(input())
d = {}

for a in range(1, n+1):
    a = str(a)
    f, l = a[0], a[-1]
    if '0' in [f, l]:
        continue
    if (f, l) in d:
        d[(f, l)] += 1
    else:
        d[(f, l)] = 1

ans = 0
for b in range(1, n+1):
    b = str(b)
    f, l = b[-1], b[0]
    if (f, l) in d:
        ans += d[(f, l)]
print(ans)

Measured memory_bytes: 40556
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int a, b; cin >> a >> b;
    cout << (a - 1) * (b - 1) << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3672
# coding: utf-8
# Your code here!
N,K,Q=map(int,input().split())
l=[0]*N

for i in range(Q):
    l[int(input())-1]+=1
    
for i in range(N):
    if (l[i]+K-Q)>0:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 4680
#include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	while(1){
		int a,b,c,d,e,na,nb,nc,ans=0;
		cin>>a>>b>>c>>d>>e;
		if(a==0) break;
		cin>>na>>nb>>nc;
		int n=na+nb+nc,sum=a*na+b*nb+c*nc;
		if(n<d){
			ans=min(d*e,sum);
		}else{
			if(nc>=d) ans=nc*e+nb*b+na*a;
			else if(nb+nc>=d){
				ans=min(sum,d*e+(nc+nb-d)*b+na*a);
			}else{
				ans=min(sum,d*e+(n-d)*a);
			}
		}
		o(ans);
	}
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long ;
int main()
{
    int n;
    cin>>n;
    vector<int> h(n);
    rep(i,n) cin>>h[i];
    int now=h[0]-1;
    for(int i=1;i<n;i++){
        if(now>h[i]){
            cout<<"No";
            return 0;
        }
        if(now<h[i]){
            now=h[i]-1;
        }
    }
    cout<<"Yes";
}

Measured memory_bytes: 3772
#include<iostream>
#include<cstring>
#include<stdio.h>
using namespace std;
inline int max(int a,int b){
  return a > b ? a : b;
}
inline int min(int a,int b){
  return a > b ? b : a;
}
int main(){
  int n,i=26,j;
  cin >>n;
  int a[26]={0};
  for(i=0;i<n;i++){
    int b[26]={0};
    char s[51];
    cin >> s;
    for(j=0;j<std::strlen(s);j++){
      b[s[j]-'a']++;
    }
    if(i==0){
      for(j=0;j<26;j++){
        a[j]=b[j];
      }
    }else{
      for(j=0;j<26;j++){
        a[j]=min(a[j],b[j]);
      }
    }
  }
  for(i=0;i<26;i++){
  while(a[i]!=0){
    printf("%c",i+97);
    a[i]--;
  }
}
}


Measured memory_bytes: 256
// atcoder/abc132/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#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; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; each (i, v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { each (i, v) is >> i; return is; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

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

  const lli mod = 1e9 + 7;
  const int N = 4000 + 5;
  const int K = 4000 + 5;

  static lli nck[N][K];
  fill(&nck[0][0], &nck[N - 1][K - 1] + 1, 0);
  for (int i = 0; i < N; ++i) {
    nck[i][0] = 1;
  }
  for (int n = 1; n < N; ++n) {
    for (int k = 1; k < K; ++k) {
      nck[n][k] = nck[n - 1][k - 1] + nck[n - 1][k];
      nck[n][k] %= mod;
    }
  }

  int n, k;
  while (cin >> n >> k) {
    for (int i = 0; i < k; ++i) {
      lli x = nck[k - 1][i] * nck[(i + 1) + (n - k - i)][(i + 1)];
      x %= mod;
      cout << x << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 125568
//package AtCoder;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int r=sc.nextInt();
		if(n<10)
		{
			r+=(100*(10-n));
		}
		System.out.println(r);

	}

}


Measured memory_bytes: 21716
#include <stdio.h>
#include <cstdlib>
#include <cassert>
#include <iostream>
#include <set>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <complex>
#include <map>
#include <queue>
#include <array>
#include <bitset>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<pii> vii;
typedef vector<string> vs;
//typedef long long int;

int f(string a0, string b0) {
  int n = a0.size();
  vector<char> a(2*n), b(2*n);
  for (int i = 0; i < n; ++i) a[n+i] = a[i] = a0[i] - '0';
  for (int i = 0; i < n; ++i) b[n+i] = b[i] = b0[i] - '0';
  vi pr(b.size(), -1), nx(b.size(), 2 * n);
  for (int i = 0; i < b.size(); ++i) {
    if (i) pr[i] = pr[i-1];
    if (b[i]) pr[i] = i;
  }
  for (int i = b.size() - 1; i >= 0; --i) {
    if (i + 1 < b.size()) nx[i] = nx[i+1];
    if (b[i]) nx[i] = i;
  }
  vii v;
  v.reserve(n);
  int res = 1e9;
  for (int x = 0; x < n; ++x) {
    int c0 = 0;
    v.clear();
    for (int i = 0; i < n; ++i) if (a[i + x] != b[i]) {
      ++c0;
      int j = (i + x) % n;
      if (a[j]) {
        int l = j + n - pr[j + n], r = nx[j] - j;
        if (l > x) {
          v.emplace_back(-r, l);
        }
      }
    }
    sort(v.begin(), v.end());
    int add = v.empty() ? 0 : 1e9;
    int ma = x;
    for (int i = 0; i < v.size(); ++i) {
//      cerr << v[i].first << ' ' << v[i].second << endl;
      add = min(add, -2 * v[i].first + 2 * (ma - x));
      ma = max(ma, v[i].second);
    }
    add = min(add, 2 * (ma - x));
    res = min(res, add + c0 + x);
//    cerr << x << ' ' << c0 << ' ' << add << endl;
  }
  return res;
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  string a0, b0;
  cin >> a0 >> b0;
  bool onea = 0, oneb = 0;
  for (int i = 0; i < a0.size(); ++i) {
    if (a0[i] == '1') onea = 1;
    if (b0[i] == '1') oneb = 1;
  }
  if (onea && !oneb) {
    cout << -1 << endl;
    return 0;
  }
  if (!onea && !oneb) {
    cout << 0 << endl;
    return 0;
  }
  int res = f(a0, b0);
  reverse(a0.begin(), a0.end());
  reverse(b0.begin(), b0.end());
  res = min(res, f(a0, b0));
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 384
mod = 10 ** 9 + 7
mod2 = 2**61+1
from collections import deque
import heapq


def iip(listed):
    ret = [int(i) for i in input().split()]
    if len(ret) == 1 and not listed:
        return ret[0]
    return ret


def main():
    r = solve()
    print(r)

def solve():
    K = iip(False)

    rl = []
    rl_next = list(range(1, 10))
    while True:
        rl_current = [i for i in rl_next]
        rl_next = []
        if len(rl) > 10 ** 5 + 10000:
            break
        for i in rl_current:
            rl.append(i)
            i0 = i * 10
            i1 = i % 10

            if i1 != 0:
                rl_next.append(i0+i1-1)
            rl_next.append(i0+i1)
            if i1 != 9:
                rl_next.append(i0+i1+1)

    #print(rl[:10])
    return rl[K-1]



#####################################################ライブラリ集ここから

def split_print_space(s):
    print(" ".join([str(i) for i in s]))


def split_print_enter(s):
    print("\n".join([str(i) for i in s]))


def koenai_saidai_x_index(sorted_list, n):
    l = 0
    r = len(sorted_list)
    if len(sorted_list) == 0:
        return False
    if sorted_list[0] > n:
        return False

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] == n:
            return x
        elif sorted_list[x] > n:
            r = x
        else:
            l = x
    return l


def searchsorted(sorted_list, n, side):
    if side not in ["right", "left"]:
        raise Exception("sideはrightかleftで指定してください")

    l = 0
    r = len(sorted_list)

    if n > sorted_list[-1]:
        # print(sorted_list)
        return len(sorted_list)
    if n < sorted_list[0]:
        return 0

    while r - l > 1:
        x = (l + r) // 2
        if sorted_list[x] > n:
            r = x
        elif sorted_list[x] < n:
            l = x
        else:
            if side == "left":
                r = x
            elif side == "right":
                l = x

    if side == "left":
        if sorted_list[l] == n:
            return r - 1
        else:
            return r

    if side == "right":
        if sorted_list[l] == n:
            return l + 1
        else:
            return l


def soinsuu_bunkai(n):
    ret = []
    for i in range(2, int(n ** 0.5) + 1):
        while n % i == 0:
            n //= i
            ret.append(i)
        if i > n:
            break
    if n != 1:
        ret.append(n)
    return ret


def conbination(n, r, mod, test=False):
    if n <= 0:
        return 0
    if r == 0:
        return 1
    if r < 0:
        return 0
    if r == 1:
        return n
    ret = 1
    for i in range(n - r + 1, n + 1):
        ret *= i
        ret = ret % mod

    bunbo = 1
    for i in range(1, r + 1):
        bunbo *= i
        bunbo = bunbo % mod

    ret = (ret * inv(bunbo, mod)) % mod
    if test:
        # print(f"{n}C{r} = {ret}")
        pass
    return ret


def inv(n, mod):
    return power(n, mod - 2)


def power(n, p, mod_= mod):
    if p == 0:
        return 1
    if p % 2 == 0:
        return (power(n, p // 2, mod_) ** 2) % mod_
    if p % 2 == 1:
        return (n * power(n, p - 1, mod_)) % mod_


if __name__ == "__main__":
    main()

Measured memory_bytes: 117868
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<math.h>
#include<bitset>
#include <numeric>
using namespace std;
using ll=long long;
using ld=long double;
using pint=pair<int,int>;
using pll=pair<ll,ll>;
#define LONG_INF 9223372036854775807
#define INF 1000000000LL
#define EPS 1e-10
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define dump(a) rep(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define all(v) v.begin(),v.end()
#define pb push_back


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

    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    ll ret=0;
    if(K<=A) ret = K;
    else ret += A;
    if(B<K-A) ret -= (K-A-B);

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 3640
// while (clock()<=69*CLOCKS_PER_SEC)
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define pb push_back
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define all(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define erase_duplicates(x) sort(all(x)); (x).resize(distance((x).begin(), unique(all(x))));


using namespace std;
using namespace __gnu_pbds;
template<typename T>
using ordered_set = tree<
T,
null_type,
less<T>,
rb_tree_tag,
tree_order_statistics_node_update>;

//X.find_by_order(k); - zwraca iterator na k-ty element (numeracja od zerowego)
//X.order_of_key(k); - zwraca liczbę elementów ostro mniejszych niż k

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<" = "<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;
  cerr<<" = "<<h<<", "; _dbg(sdbg+1, a...);
}

#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#define cerr if(0)cout
#endif

const int maxn = (1e6)+7;
const int maxk = 20;
const int inf = (1e9)+7;
const LL LLinf = ((LL)1e18)+7LL;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

int main()
{
	_upgrade
  LL a, v, b, w, t;
  cin>>a>>v>>b>>w>>t;
  if(a > b)
    swap(a, b);
  LL ma = a + v * t;
  if(b + w * t <= ma)
    cout<<"YES";
  else
    cout<<"NO";
	return 0;
}


Measured memory_bytes: 3644
from sys import stdin

N = int(stdin.readline().rstrip())
X_list = []
L_list = []
#left_pos = []
#right_pos = []
range_pos = []
for i in range(N):
    [X, L] = [int(x) for x in stdin.readline().rstrip().split()]
    X_list.append(X)
    L_list.append(L)
    range_pos.append([X+L, X-L])

range_pos.sort()

index  = 0
prev_right = -1e8
for i in range(N):
    if prev_right <= range_pos[i][1]:
        prev_right = range_pos[i][0]
        index+=1

print(index)


Measured memory_bytes: 28112
#include <iostream>

using namespace std;

void bubbleSort(int* A, int n, int& num) {
  bool flag = true;
  while (flag) {
    flag = false;
    for (int j = n - 1; j >= 1; j--) {
      if (A[j] < A[j - 1]) {
        swap(A[j], A[j - 1]);
        flag = true;
        num++;
      }
    }
  }
}

int main () {
  int n;
  cin >> n;
  int A[101];
  int num = 0;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
  }
  bubbleSort(A, n, num);
  for (int i = 0; i < n; i++) {
    cout << A[i];
    if (i != n - 1) {
      cout << ' ';
    }
  }
  cout << endl;
  cout << num << endl;
}

Measured memory_bytes: 3108
using System;

namespace B_003_58
{
    internal class Program
    {
        private static void Main(string[] args)
        {

            new Logic_B().Start();

        }

        public class Logic_B
        {
            public void Start()
            {
                var a1 = Console.ReadLine();
                var a2 = Console.ReadLine();
                var pass = string.Empty;
                for (int i = 0; i < a1.Length; i++)
                {
                    pass += a1[i].ToString();
                    if (a2.Length != i)
                    {
                        pass += a2[i].ToString();
                    }
                }
                Console.WriteLine(pass);
            }
        }

    }
}

Measured memory_bytes: 11092
package main

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

//=====I/O=====

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

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

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ { res[i] = scanInt() }
	return res
}

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

func printInts(a ...int) {
	for i, e := range a {
		fmt.Fprint(wr, e)
		if i != len(a)-1 { fmt.Fprint(wr, " ") }
	}
	fmt.Fprintln(wr)
	wr.Flush()
}

//=====main=====

func main() {
	sc.Split(bufio.ScanWords)

	n := scanInt()
	a := scanInts(n)

	c := 0
	p := 1
	f := false

	for i := 0; i < n; i++ {
		if a[i] == p {
			p++
			f = true
		} else {
			c++
		}
	}

	if f {
		fmt.Println(c)
	} else {
		fmt.Println(-1)
	}

}


Measured memory_bytes: 3840
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX + 1];

void maxHeapify(int i) {
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;

	if (l <= H && A[l] > A[i]) largest = l;
	else largest = i;
	if (r <= H && A[r] > A[largest]) largest = r;

	if (largest != i) {
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}
}

int extract() {
	int maxv;
	if (H < 1) return -INFTY;
	maxv = A[1];
	A[1] = A[H--];
	maxHeapify(1);
	return maxv;
}

void increaseKey(int i, int key) {
	if (key < A[i]) return;
	A[i] = key;
	while (i > 1 && A[i / 2] < A[i]) {
		swap(A[i], A[i / 2]);
		i = i / 2;
	}
}

void insert(int key) {
	H++;
	A[H] = -INFTY;
	increaseKey(H, key);
}

int main() {
	int key;
	char com[10];

	while (1) {
		scanf("%s", com);
		if (com[0] == 'e' && com[1] == 'n') break;
		if (com[0] == 'i') {
			scanf("%d", &key);
			insert(key);
		}
		else {
			printf("%d\n", extract());
		}
	}

	return 0;
}


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

vector <long long int > Ans;
int A[12][12];
int C[12];
int N,M;
int X;

void solve(vector<int> v){
    int n = v.size();
    int t=1;
    long long int sumc =0;
    for(int i=0;i<M;i++){
        long long int suma=0;
        for(int j=0;j<n;j++){
            suma+=A[v[j]][i];

        }
  
        if(suma<X){
            t=0;
            break; }
        
    }
    if(t){
        for(int i=0;i<n;i++){
            sumc += C[v[i]];
        }
        Ans.push_back(sumc);
    }
    else{Ans.push_back(-1);}


}

void make(int N,vector<int> v,int min,int max){
    if(N==0){return;}
    else {
        for(int i=min;i<max;i++){
        vector<int> nv = v;
        nv.push_back(i);
        solve(nv);
        make(N-1,nv,i+1,max);
    }
    return ;
    }



}

int main(){
    cin >> N >> M >> X;
    for(int i=0;i<N;i++){
        cin >> C[i];
        for(int j=0;j<M;j++){
            cin >> A[i][j];
        }
    }
    vector<int> v;
    make(N,v,0,N);
    int ans_len = Ans.size();
    long long int mn = 1200000;
    int  t=0;

    for(int i=0;i<ans_len;i++){
        if(Ans[i]>=0){
            t=1;
            if(Ans[i] < mn){mn=Ans[i];}
        }
    }
    if(t){cout << mn << endl;}
    else{cout << -1 << endl;}

}

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
map < int, long long > occ;
int main(){
	int n;
    cin >> n;
    long long ans = 1LL;
    occ[-1] = 3LL;
    for(int i = 0 ; i < n ; ++i){
        long long x;
        cin >> x;
        ans = (ans * occ[x - 1]) % mod;
        if(occ[x - 1]) occ[x - 1]--;
        occ[x]++;
    }
    cout << ans << '\n';
    return 0;
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	int h1, m1, h2, m2, k; read(h1, m1, h2, m2, k);
	int ans = h2*60+m2 - (h1*60+m1) - k;
	die(ans);
}


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

int main() {
  string c;
  cin >> c;

  if (c == "a" || c == "i" || c == "u" || c == "e" || c == "o")
    cout << "vowel" << endl;
  else 
    cout << "consonant" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vec vector
#define vi vec<int>
#define vvi vec<vec<int>>
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
#define SORT(a) stable_sort(ALL(a))
#define RSORT(a) stable_sort(RALL(a))
#define REV(a) reverse(ALL(a))
#define UNIQUE(a) a.erase(unique(ALL(a)), end(a))
#define lambda(i) [=](auto i)
#define compare(i, j) [=](auto i, auto j)
#define min_of(a) *min_element(ALL(a))
#define max_of(a) *max_element(ALL(a))
#define sum(a) accumulate(ALL(a), 0)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(a) (int)(a).size()
#define REP(i, n) for (decltype(+n) i = 0; i < (n); i++)
#define RREP(i, n) for (auto i = n - 1; i != static_cast<decltype(i)>(-1); i--)
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define RFOR(i, a, b) for (auto i = b - 1; i != a; i--)
#define EACH(i, a) for (auto&& i: (a))
using namespace std;

const int INF = 1e18;
const int MOD = 1e9 + 7;

int ceil_div(int X, int Y) {
  return (X - 1) / Y + 1;
}

struct union_find {
  vi data;
  union_find(int size) : data(size, -1) { }
  bool union_set(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool find_set(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

vi cum(vi V) {
  vi U(SZ(V));
  partial_sum(ALL(V), begin(U));
  return U;
}

void solve() {
  int n;
  int ans = 0;

  cin >> n;
  FOR(i, 1, n + 1)FOR(j, 1, n + 1)FOR(k, 1, n + 1) {
    ans += __gcd(i, __gcd(j, k));
  }

  cout << ans << endl;
  // REP(i, n) {
  //   cout << v[i];
  // }
}

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(15);
  solve();
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> trp;
typedef vector<ll> vi;
typedef vector<pll> vp;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define f1(i,n)     for(ll i=1;i<=n;i++)
#define fs(i,s)     for(ll i=0;i+1<=s.length();i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define pob         pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define sc3(a,b,c)  cin>>a>>b>>c
#define pr(a)       cout<<a<<endl
#define pr2(a,b)    cout<<a<<" "<<b<<endl
#define rpr(a)      return cout<<a<<endl,0
#define prY         cout<<"Yes"<<endl
#define prN         cout<<"No"<<endl
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define	mp3(a,b,c)  make_pair(a,make_pair(b,c))
#define se          second
#define fi          first 
#define sse         second.second
#define sfi         second.first
#define soA         sort(A+1,A+1+n)
#define so(A,n)     sort(A+1,A+1+n)
#define sov(v)      sort(all(v))
#define sovr(v)     sort(all(v),greater<ll>())
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll mnz(ll& a,ll b){return a=(a>b?b:a);}
inline ll mxz(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


ll A[MAXN+5],B[MAXN+5];

ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	sc(n);
	f1(i,n){
		sc(x);
		B[i]=x;
		A[x]++;
	}
	f1(i,n)sum+=(A[i]*(A[i]-1))/2;
	f1(i,n){
		pr(sum-(A[B[i]]*(A[B[i]]-1))/2+((A[B[i]]-2)*(A[B[i]]-1))/2);
	}
	
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	if(fopen("locin.txt", "r"))INPUT;
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	} 		
}

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

int main() {
  vector<int> size(3);
  for(int i = 0; i < 3; i++){
    cin >> size.at(i);
  }
  sort(size.begin(), size.end());
  cout << size.at(0) * size.at(1) / 2 << endl;
}


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

using namespace std;

#define COUNTOF(array) (sizeof(array) / sizeof(array[0]))
#define OUT(P) cout << (P) << endl
#define OUT2(P1, P2) cout << (P1) << " " << (P2) << endl

int main() {
    int a, b, c, d;
    string LEFT = "Left";
    string BALANCED = "Balanced";
    string RIGHT = "Right";

    cin >> a >> b >> c >> d;

    int left = a + b;
    int right = c + d;

    if(left > right) {
        cout << LEFT << endl;
    } else if(left == right) {
        cout << BALANCED << endl;
    } else {
        cout << RIGHT << endl;
    }


    return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

long long gcd(long long a, long long b) {
    if(a < b) gcd(b, a);
    long long r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

int main(){
    int n;
    cin >> n;
    long long a[n];

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

    for(int i=1;i<n;i++){
        a[0] = gcd(a[0], a[i]);
    }
    cout << a[0] << endl;
    return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    int d[n];
    int res;
    for (int i=0;i < n;i++){
	cin >> d[i];
    }

    sort(d,d+n);
    cout << d[n/2] - d[n/2 - 1] << endl;
	
}


Measured memory_bytes: 640
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define ml m
#define mr m + 1
#define lson id << 1
#define rson id << 1 | 1
#define Error(x) cout << #x << " = " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int inf  = 0x3f3f3f3f;
const int maxn = 1e5 + 15;
const int maxm = 1e6 + 15;

int main() {
#ifdef NEKO
	freopen("C:\\Nya.txt", "r", stdin);
#endif
	string s; cin >> s;
	cout << s.substr(0, 4) << ' ' << s.substr(4) << endl;;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<vector>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;

string s;
int main(){
    cin>>s;
    ll gCnt=0,pCnt=0;
    for(auto c:s){
        if(c=='g'){
            gCnt++;
        }else{
            pCnt++;
        }
    }
    cout<<(gCnt-pCnt)/2<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<stdio.h>
#include<time.h>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int qx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int qy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		ll n;
		cin>>n;
		if(n==0) break;
		vector<ll> a(n);
		REP(i, n) cin>>a[i];
		ll gap = INF;
		sort(ALL(a));
		FOR(i, 1, n) gap = min(gap, a[i] - a[i - 1]);
		cout<<gap<<endl;
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define forn(i, a, n) for (int i = a; i < n; ++i)
#define ford(i, a, n) for (int i = n - 1; i >= a; --i)
#define fore(i, a, n) for (int i = a; i <= n; ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
	for (auto i : a) cerr << i << ' ';\
	cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

const int N = 100010;
const int LOG = 17;

int nxt[LOG][N];

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> x(n);
	forn(i, 0, n) cin >> x[i];
	int l;
	cin >> l;
	forn(i, 0, n) nxt[0][i] = upper_bound(all(x), x[i] + l) - x.begin() - 1;
	forn(i, 1, LOG) forn(j, 0, n) nxt[i][j] = nxt[i - 1][nxt[i - 1][j]];
	int q;
	cin >> q;
	while(q--) {
		int a, b;
		cin >> a >> b;
		if (a > b) swap(a, b);
		--a, --b;
		int ans = 0, i = 0;
		while (i < LOG && nxt[i][a] < b) ++i;
		--i;
		while (i >= 0) {
			if (nxt[i][a] < b) {
				a = nxt[i][a];
				ans += (1 << i);
			}
			--i;
		}
		cout << ans + 1 << '\n';
	}
	return 0;
}


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

using namespace std;

int Judge[10];

int main() {
	int h, b;
	string r, a;

	while (cin >> r >> a, r.size() != 1) {
		//cout << r << " " << a << endl;
		memset(Judge, 0, sizeof(Judge));
		h = b = 0;
		for (int i = 0; i < 4; ++i) {
			if (r[i] == a[i]) {
				++h;
			}
			else {
				++Judge[r[i] - '0'];
			}
		}
		for (int i = 0; i < 4; ++i) {
			if (Judge[a[i] - '0'] != 0) {
				++b;
			}
		}
		cout << h << " " << b << endl;
	}

	return 0;
}


Measured memory_bytes: 3052