akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#define M 100001

typedef struct{
    int p,l,r;
}Node;

Node N[M];

int depth(int i,int d){
    if(N[i].p==-1)    return d;
    else return depth(N[i].p,++d);
}

int sib(int i){
    if(N[i].p==-1) return -1;
    if(N[N[i].p].r==i) return N[N[i].p].l;
    if(N[N[i].p].l==i) return N[N[i].p].r;
    return -1;
}

int deg(int i){
    int c=0;
    if(N[i].l!=-1) c++;
    if(N[i].r!=-1) c++;
    return c;
}

int hei(int i){
    int a=0,b=0;
    if(N[i].l!=-1) a=hei(N[i].l)+1;
    if(N[i].r!=-1) b=hei(N[i].r)+1;
    if(a>b) return a;
    else      return b;
}

int main(void){
    int i,n,id,c,l,r;
    scanf("%d",&n);
    for(i=0;i<n;i++){
        N[i].p=-1;
        N[i].l=-1;
        N[i].r=-1;
    }
    
    for(i=0;i<n;i++){
        scanf("%d %d %d",&id,&l,&r);
        N[id].l=l;
        N[id].r=r;
        N[l].p=id;
        N[r].p=id;
    }
    
    for(i=0;i<n;i++){
        c=0;
        if(N[i].l!=-1) c++;
        if(N[i].r!=-1) c++;
        
        printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",i,N[i].p,sib(i),c,depth(i,0),hei(i));
        if(N[i].p==-1) printf("root");
        else if(N[i].l==-1 && N[i].r==-1) printf("leaf");
        else printf("internal node");
        printf("\n");
    }
    return 0;
}
    


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

const int mod = 1000000007;
struct mint {
	ll x;
	mint(ll x = 0) :x((x% mod + mod) % mod) {}
	mint operator-() const { return mint(-x); }
	mint& operator+=(const mint a) {
		if ((x += a.x) >= mod) {
			x -= mod;
		}
		return *this;
	}
	mint& operator-=(const mint a) {
		if ((x += mod - a.x) >= mod) {
			x -= mod;
		}
		return *this;
	}
	mint& operator*=(const mint a) {
		(x *= a.x) %= mod;
		return *this;
	}
	mint operator+(const mint a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint a) const {
		mint res(*this);
		return res /= a;
	}
};

int main() {
	int X, Y;
	cin >> X >> Y;

	int N;
	if ((X + Y) % 3 == 0) {
		N = (X + Y) / 3;
		if (Y > (2 * X) || (2 * Y) < X) {
			cout << 0 << endl;
			return 0;
		}
	}
	else {
		cout << 0 << endl;
		return 0;
	}

	int K = min(X - N, 2 * N - X);
	mint ans = 1;
	rep(i, K) {
		ans *= (N - i);
		ans /= (K - i);
	}

	cout << ans.x << endl;

}

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

typedef long long int   ll;
#define int             ll
#define PI              3.1415926535897932384626433832795

#define pb              push_back
#define rep0            for(int i=0;i<n;i++)
#define rep1            for(int i=1;i<=n;i++)
#define inputar0(ar)    for(int i=0;i<n;i++)cin>>ar[i]
#define inputar1(ar)    for(int i=1;i<=n;i++)cin>>ar[i]

#define hell            freopen("input.txt","r", stdin);freopen("output.txt", "w", stdout);freopen("error.txt", "w",stderr);
#define fastasF_boi()   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl            "\n"
//#define cerr            if(false)cerr

int mod=1000000007;
int maxn=200001;
int binpow(int a,int b,int mod){int res=1;while(b>0){if(b%2){res=(res*a)%mod;b--;}a=(a*a)%mod;b/=2;}return res%mod;}
int binpow(int a,int b){int res=1;while(b>0){if(b%2){res=(res*a);b--;}a=(a*a);b/=2;}return res;}
bool isPrime(int n){if(n==1)return false;for(int i=2;i*i<=n;i++){if(n%i==0)return false;}return true;}
int mulmod(int a,int b){return ((a%mod)*(b%mod))%mod;}
int addmod(int a,int b){return (((a%mod)+(b%mod))+mod)%mod;}

void solve();

signed main(){
//    hell;

    fastasF_boi();
    int t=1;
//    cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
}

void solve(){
    int a,b,c;
    cin>>a>>b>>c;
    int k;cin>>k;
    while(a>=b){
        b*=2;
        k--;
    }
    while(b>=c){
        c*=2;
        k--;
    }
    if(k<0) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}


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

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

    int a[3] = {INF, INF, INF};
    rep(i, M) {
        int s, c;
        cin >> s >> c;
        s--;

        if (a[s] == INF)
            a[s] = c;
        else if (a[s] != c) {
            cout << -1 << endl;
            return 0;
        }
    }

    rep(i, N) {
        if (i == 0 && a[i] == 0) {
            if (N == 1)
                cout << 0;
            else {
                cout << -1 << endl;
                return 0;
            }
        } else if (a[i] == INF) {
            if (i == 0) {
                if (N == 1)
                    cout << 0;
                else
                    cout << 1;
            } else
                cout << 0;
        } else
            cout << a[i];
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
my ($n, $k) = split ' ', <>;
my @a = ();
for (1..$k) {
    <>;push @a, [ split ' ', <> ];
}
my %tmp_hash = ();
for (@a) {
    %tmp_hash = (%tmp_hash, map { $_ => 1 } @$_);
}
print $n - scalar keys %tmp_hash;

Measured memory_bytes: 5496
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
struct person
{
	int h, p;
	bool operator<(const person a) const
	{
		return h + p < a.h + a.p;
	}
} a[5001];
int n;
long long dp[5005];
void checkmin(long long &x, long long y)
{
	if (x > y)
	{
		x = y;
	}
}
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%d", &a[i].h, &a[i].p);
	}
	sort(a + 1, a + n + 1);
	for (int i = 1; i <= n; i++)
	{
		dp[i] = 1e18;
	}
	for (int i = 1; i <= n; i++)
	{
		for (int j = i; j >= 1; j--)
		{
			if (dp[j - 1] <= a[i].h)
			{
				checkmin(dp[j], dp[j - 1] + a[i].p);
			}
		}
	}
	for (int i = n; i >= 1; i--)
	{
		if (dp[i] < 1e18)
		{
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}


Measured memory_bytes: 3912
#include <stdio.h>
#include <math.h>

int main(void)
{
    int a=0,b=0,h=0,m=0;
    double alf=0.0,beta=0.0,theta=0.0,len=0.0;
    scanf("%d %d %d %d",&a,&b,&h,&m);

    alf=30.0*((double)h+(double)m/60.0);
    beta=(double)m*6.0;

    theta=alf-beta;
    if(theta<0) theta=(-1.0)*theta;

    len=sqrt((double)(a*a)+(double)(b*b)-2*(double)a*(double)b*cos(2*M_PI*theta/360.0));

    printf("%15.11f",len);
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> L;
  int sum = 0;
  for(int i = 0; i < n; i++){
    int temp; cin >> temp;
    L.push_back(temp);
    sum += temp;
  }
  sort(L.begin(), L.end());
  string ans;
  if(sum - L[n-1] <= L[n-1] )ans = "No";
  else ans = "Yes";
  
  cout << ans << endl;
}

Measured memory_bytes: 256
from math import ceil
mnu = []
idx = []
for _ in range(5):
    tim = input()
    mnu.append(int(tim))
    idx.append(10) if tim[-1] == "0" else idx.append(int(tim[-1]))

lst = idx.index(min(idx))
res = mnu[lst]
for i in range(5):
    if lst == i:
        continue
    res += (ceil(mnu[i]/10)*10)
print(res)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define ALL(v) (v).begin(), (v).end()

using namespace std;
using ll = long long;

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

int main()
{
  char c; cin >> c;
  cout << string(1, c+1) << endl;
}


Measured memory_bytes: 256
//
//  main.cpp
//  Tenka1PBC2019
//
//  Created by hiroaki on 2019/04/21.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

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

int main() {
    int a,b,c;
    cin >>a>>b>>c;
    if (a<c&&c<b) {
        cout<<"Yes"<<endl;
    }else if(b<c&&c<a){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


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

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> TUPLE;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;

int dfs(string s) {
    s = s.substr(1, s.size() - 2);
    if (isdigit(s[0])) return (stoi(s) + 1) / 2;

    V v;
    int depth = 0;
    int l = 0;
    rep(i, s.size()) {
        if (s[i] == '[') depth++;
        if (s[i] == ']') depth--;

        if (depth == 0) {
            v.emplace_back(dfs(s.substr(l, i - l + 1)));
            l = i + 1;
        }
    }

    sort(all(v));
    int ret = 0;
    rep(i, (v.size() + 1) / 2) ret += v[i];
    return ret;
}

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

    int T;
    cin >> T;
    rep(t, T) {
        string s;
        cin >> s;
        cout << dfs(s) << endl;
    }
}

Measured memory_bytes: 3196
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i=0;i < (int)(n);i++)

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  sort(v.begin(),v.end());
  int ans = 0;
  rep(i,k){
    ans += v[i];
  }
  cout << ans << endl;

  return 0;
  
}


Measured memory_bytes: 3568
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
//typedef __int64 LL;
typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;

const int MOD=998244353;

LL table[200020];

LL beki(LL a,LL b)
{
	if(b==0)return 1;
	LL x=beki(a,b/2);
	if(b%2==0)return (x*x)%MOD;
	else return (((a*x)%MOD)*x)%MOD;
}

LL inv(LL a)
{
	return beki(a,MOD-2);
}

LL kaijou(LL a)
{
	LL ans=1;
	for(LL i=1;i<=a;i++)
	{
		ans=(ans*i)%MOD;
	}			
	return ans;
}

LL combi(LL a,LL b)
{
	LL ret=1;
	table[0]=1;
	for(LL i=1;i<=b;i++)
	{
		ret=(((ret*(a+1-i))%MOD)*inv(i))%MOD;
		table[i]=ret;
	}
	return ret;
}


int main(){
	LL n,m,k;
	LL ans=0;
	cin>>n>>m>>k;
	combi(n-1,k);
	
	for(LL i=0;i<=k;i++)
	{
		ans=(ans+((m*table[i])%MOD)*beki(m-1,n-1-i))%MOD;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 5144
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/*
 public class arc085c {

 }

 */
public class Main {
  public void solve() throws FileNotFoundException {
    InputStream inputStream = System.in;

    InputHelper in = new InputHelper(inputStream);

    // actual solution
    int n = in.readInteger();
    int m = in.readInteger();
    
    int ans = (1900 * m + 100 * (n - m)) * (1 << m);

    System.out.println(ans);
    // end here
  }

  public static void main(String[] args) throws FileNotFoundException {
    (new Main()).solve();
  }

  class InputHelper {
    StringTokenizer tokenizer = null;
    private BufferedReader bufferedReader;

    public InputHelper(InputStream inputStream) {
      InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
      bufferedReader = new BufferedReader(inputStreamReader, 16384);
    }

    public String read() {
      while (tokenizer == null || !tokenizer.hasMoreTokens()) {
        try {
          String line = bufferedReader.readLine();
          if (line == null) {
            return null;
          }
          tokenizer = new StringTokenizer(line);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }

      return tokenizer.nextToken();
    }

    public Integer readInteger() {
      return Integer.parseInt(read());
    }

    public Long readLong() {
      return Long.parseLong(read());
    }
  }
}


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

#include <iostream>
#include <algorithm>
#include <set>
#include <map>
#include <set>
#include <vector>
#include <string.h> // for memset in CF judge.
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE // suppress some compilation warning messages (for VC++ users)
// Shortcuts for "common" data types in contests
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
// To simplify repetitions/loops, Note: define your loop style and stick with it!
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++) // a to b, and variable i is local!
#define forn(i,n) \
for (int i =0; i<(n); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)
#define INF 2000000000 // 2 billion
// If you need to recall how to use memset:
#define MEMSET_INF 127 // about 2B
#define MEMSET_HALF_INF 63 // about 1B
//memset(dist, MEMSET_INF, sizeof dist); // useful to initialize shortest path distances
//memset(dp_memo, -1, sizeof dp_memo); // useful to initialize DP memoization table
//memset(arr, 0, sizeof arr); // useful to clear array of integers
int N, R;
int main() {
    cin >> N >> R;
    int ans, innerRat;
    if(N > 10) {
        innerRat = R;
    } else {
        innerRat = R + (100 * (10 - N));
    }
    cout << innerRat;
return 0; 
}


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

#define F first
#define S second
typedef double db;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll gcd(ll x,ll y){
return y? gcd(y,x%y):x;
}

int main(){
  ll a,b,c;
  cin>>a>>b>>c;
  swap(a,b);
  swap(a,c);
  cout<<a<<' '<<b<<' '<<c<<endl;
return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val k = sc.nextInt()
    println(problempanasonic2020a(k))
}

fun problempanasonic2020a(k: Int): Int {
    return listOf<Int>(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)[k - 1]
}

Measured memory_bytes: 35652
N = int(input())

ans = ''
m = 2
i = 0

while 1:
  if N % m != 0:
    ans += '1'
    N = N - (-2)**i
  else:
    ans += '0'
  m *= 2
  i += 1
  if N == 0:
    break

print(ans[::-1])


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

using namespace std;


struct fun{
    int x;
    int y;
};

int fact(int n){
    if(n == 1){
        return 1;
    }else{
        return n * fact(n-1);
    }
}

struct fun p[10];
double d[1000];
int t = 1;

int main()
{
    int count = 0;
    int n;
    double sum = 0;
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> p[i].x >> p[i].y;
    }
    for(int i=2;i<=n;i++){
        t *= i;
    }
    t *= 2;
    t /=n;
    for(int i=0;i<n-1;i++){
        for(int j=i+1;j<n;j++){
            d[count++] = sqrt((p[i].x -p[j].x)*(p[i].x -p[j].x) + (p[i].y -p[j].y)*(p[i].y -p[j].y));
        }
    }

    for(int i=0;i<count;i++){
        sum += d[i];
    }
    double ans = t*sum/fact(n);;
    printf("%.10lf\n",ans);


    

    return 0;
}


Measured memory_bytes: 256
def DP(s):
    N = len(s)
    dp = [[0] * (3) for i in range(N+1)]
    rsp = {'s':0, 'p':1, 'r':2}
    for i in range(N):
        for j in range(3):
            for k in range(3):
                win = int(rsp[s[i]] == k) * RSP[k]
                if j != k: dp[i+1][k] = max(dp[i+1][k], dp[i][j] + win)
    return max(dp[N])

N, K = map(int, input().split())
RSP = list(map(int, input().split()))
T = input()

ans = 0
for i in range(K):
    t = ''
    for j in range(i, N, K): t += T[j]
    ans += DP(t)
print(ans)


Measured memory_bytes: 22752
#include<bits/stdc++.h>
using namespace std;
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; }

const long long INF = 1LL << 60;

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

  if(x==1 or x==2*N-1){
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;

  if(N==2){
    cout << 1 << endl;
    cout << 2 << endl;
    cout << 3 << endl;
    return 0;
  }

  int A[2*N-1];
  bool flag[2*N];
  for(int i=0;i<2*N;i++){
    flag[i] = false;
  }
  if(x==2){
    A[N] = x-1;
    flag[x-1] = true;
    A[N-1] = x;
    flag[x] = true;
    A[N-2] = x+1;
    flag[x+1] = true;
    A[N+1] = x+2;
    flag[x+2] = true;
  }else{
    A[N] = x+1;
    flag[x+1] = true;
    A[N-1] = x;
    flag[x] = true;
    A[N-2] = x-1;
    flag[x-1] = true;
    A[N+1] = x-2;
    flag[x-2] = true;
  }

  int i;
  int c=1;
  for(i=0;i<N-2;i++){
    while(flag[c]){
      c += 1;
    }
    A[i] = c;
    flag[c] = true;
    c += 1;
  }
  for(i=N+2;i<2*N-1;++i){
    while(flag[c]){
      c += 1;
    }
    A[i]=c;
    flag[c] = true;
    c += 1;
  }

  for(int i=0;i<2*N-1;++i){
    cout << A[i] << endl;
  }




}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
using ll = long long;
#define vl vector<long long>
#define vvl vector<vector<long long>>
#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++)
using pll = pair<long long,long long>;
#define cY cout<<"Yes"<<endl
#define cN cout<<"No"<<endl
const long long INF = 1LL << 60;
const long long MOD = 1000000007;

//最大最小の入れ替え
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;
}

//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
//以上テンプレ
ll nCr(ll n, ll r) {
    ll ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}


int main(){
    ll N;
    cin>>N;
    ll ans=0;
    rep(i,N-1){
        ans+=i+1;
    }
    cout<<ans<<endl;
    }


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

long long f(long long n) {
  long long res = 0;
  while (n > 0) {
	res += n%10;
	n /= 10;
  }
  return res;
}

double g(long long n) {
  return (double)(n)/f(n);
}

int main() {
  vector<long long> res;
  long long base = 1;

  // まずは候補を (1〜150)99999 的なやつを全列挙
  for (int i = 0; i < 15; ++i) {
	for (int j = 1; j < 150; ++j) {
	  res.push_back(base * (j+1) - 1);
	}
	base *= 10;
  }
  sort(res.begin(), res.end());
  res.erase(unique(res.begin(), res.end()), res.end());

  // ダメなやつを除く
  for (long long i = 0; i < res.size(); ++i) {
	for (long long j = i+1; j < res.size(); ++j) {
	  if (g(res[i]) > g(res[j])) {
		res.erase(res.begin() + i--);
		break;
	  }
	}
  }

  long long K;
  cin >> K;
  for (long long i = 0; i < K; ++i) {
	cout << res[i] << endl;
  }
}




























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

int isPal(string str)
{
	int l = 0; 
    int h = str.length() - 1; 
  
    
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        { 
            return -1;
        } 
    } 
    
    return 1;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string S;
	cin>>S;

	int N = S.length();

	string S1,S2;

	for(int i = 0;i<(N-1)/2;i++)
		S1 = S1 + S[i];

	for(int i = ((N+3)/2)-1;i<N;i++)
		S2 = S2 + S[i];


	if(isPal(S) == 1 && isPal(S1) == 1 & isPal(S2) == 1)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


bool calc(string s, string t) {
    auto n = s.length;
    s = s ~ s;
    for (int i = 0; i < n; i++) {
        if (s[i..i+n] == t)
            return true;
    }
    return false;
}

void main() {
    auto s = readln.chomp;
    auto t = readln.chomp;
    writeln(calc(s, t) ? "Yes" : "No");
}


Measured memory_bytes: 256
import java.util.Scanner
import kotlin.system.exitProcess

val MOD = 998244353

fun main(args: Array<String>) {
	val scn = Scanner(System.`in`)
	val n = scn.nextInt()
	val ds = IntArray(n){scn.nextInt()}.toMutableList()
	if (ds[0]!=0) retire()
	ds.removeAt(0)
	ds.sort()
	if (ds[0]!=1) retire()
	var ans = 1L
	var l = 1
	var cntBef = 1
	var cnt = 0
	for (d in ds){
		when(d){
			l -> cnt++
			l+1 -> {
				ans = (ans*powMod(cntBef, cnt))%MOD
				cntBef = cnt
				cnt = 1
				l++
			}
			else -> retire()
		}
	}
	if (cnt!=0) ans = (ans*powMod(cntBef, cnt))%MOD
	println(ans)
}

fun powMod(b: Int, e: Int): Long{
	if (b==1) return 1
	var ans = 1L
	var b = b.toLong()
	var e = e
	while (e!=0){
		if (e%2==1) ans = (ans*b)%MOD
		b = (b*b)%MOD
		e /= 2
	}
	return ans
}

fun retire(){
	println(0)
	exitProcess(0)
}

Measured memory_bytes: 56568
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

int main() {
  int x, y;
  cin >> x >> y;
  vector<int> cnt(13);
  cnt[x]++;
  cnt[y]++;

  if (cnt[1] + cnt[3] + cnt[5] + cnt[7] + cnt[8] + cnt[10] + cnt[12] == 2)
    cout << "Yes" << endl;
  else if (cnt[4] + cnt[6] + cnt[9] + cnt[11] == 2)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

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

typedef struct{
	int N,M;
	int **AB;
}DATA;//input

void frac(DATA data,int *C,int a){
	for(int i=1;i<data.N;i++){
		if(C[i]==0){
			if(data.AB[a][i]==1){
				C[i]=1;
				frac(data,C,i);
			}
		}
	}
}

void show(int **C,int N){
	int D_count=0;
	int *D=(int*)malloc(sizeof(int)*N);
	for(int i=0;i<N;i++){
			D[i]=0;
		
	}
	for(int i=1;i<N;i++){
		D_count=0;
		for(int j=1;j<N;j++){
			if((C[i][j]==1) && (C[j][i]==1)){
				D[D_count++]=j;
			}
		}
		for(int j=0;j<D_count;j++){
			printf("%d",D[j]);
			if(j==(D_count-1)){
				printf("\n");
			}else{
				printf(" ");
			}
		}
	}
}

void calc(DATA data){
	int N=data.N;
	int **C=(int**)malloc(sizeof(int*)*N);
	for(int i=0;i<N;i++){
		C[i]=(int*)malloc(sizeof(int)*N);
		for(int j=0;j<N;j++){
			C[i][j]=0;
		}
	}

	for(int i=1;i<N;i++){
		frac(data,C[i],i);
		C[i][i]=1;
	}

	show(C,N);

}

int main(){
	
	DATA data;

	scanf("%d %d",&data.N,&data.M);
	data.N++;
	
	data.AB=(int**)malloc(sizeof(int*)*data.N);
	for(int i=0;i<data.N;i++){
		data.AB[i]=(int*)malloc(sizeof(int)*data.N);
		for(int j=0;j<data.N;j++){
			data.AB[i][j]=0;
		}
	}
	int a,b;
	for(int i=0;i<data.M;i++){
		scanf("%d %d",&a,&b);
		data.AB[a][b]=1;
	}

	calc(data);

	return 0;
}


Measured memory_bytes: 2536
import java.util.*;
//import java.util.stream.Collectors;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		boolean b = true;
		while(s.length() != 0){
			if(s.endsWith("dream") || s.endsWith("erase")){
				s = s.substring(0, s.length() - 5);
			}else if(s.endsWith("eraser")){
				s = s.substring(0, s.length() - 6);
			}else if(s.endsWith("dreamer")){
				s = s.substring(0, s.length() - 7);
			}else{
				b = false;
				break;
			}
		}
		System.out.println(b ? "YES" : "NO");
	}
}


Measured memory_bytes: 55796
import sys
import math
import itertools
import collections

def solve(A,B,H,M) -> float:
    radius = math.pi * 2 * (H / 12 + (M / 60) / 12 - M / 60)
    ans = math.sqrt(A **2 + B ** 2 - (2 * A * B * math.cos(radius)))
    return ans
def main():
    A,B,H,M = map(int,input().split())
    # solve()
    print(solve(A,B,H,M))

if __name__ == "__main__":
    main()


Measured memory_bytes: 9620
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

double W,H,x,y;

int main(void) {
    cin>>W>>H>>x>>y;

    double area;

    area = (1.0*W*1.0*H) / 2.0;

    if(x == W / 2 && y == H / 2) {
        cout<<area<<" "<<1<<endl;
    } else {
        cout<<area<<" "<<0<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

struct dice
{
	int top;
	int front;
	int right;
	int left;
	int back;
	int bottom;
};

int main(void)
{
	struct dice dice1;
	char act[101];
	int temp;
	int i;

	scanf("%d %d %d %d %d %d", &dice1.top, &dice1.front, &dice1.right, &dice1.left, &dice1.back, &dice1.bottom);
	scanf("%s", act);
	for(i = 0;act[i] != '\0';i++)
	{
		switch(act[i])
		{
			case 'E':
				temp = dice1.top;
				dice1.top = dice1.left;
				dice1.left = dice1.bottom;
				dice1.bottom = dice1.right;
				dice1.right = temp;
				break;
			case 'W':
				temp = dice1.top;
				dice1.top = dice1.right;
				dice1.right = dice1.bottom;
				dice1.bottom = dice1.left;
				dice1.left = temp;
				break;
			case 'S':
				temp = dice1.top;
				dice1.top = dice1.back;
				dice1.back = dice1.bottom;
				dice1.bottom = dice1.front;
				dice1.front = temp;
				break;
			case 'N':
				temp = dice1.top;
				dice1.top = dice1.front;
				dice1.front = dice1.bottom;
				dice1.bottom = dice1.back;
				dice1.back = temp;
				break;
			default:
				break;
		}
	}
	printf("%d\n", dice1.top);

	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define x first
#define y second
#define y1 secondy1
#define rank tipa_rank
#define pb push_back
#define mp make_pair
#define pow10 tipa_pow10
#define ll long long
#define INF 1000000000
#define EPS 1e-9
#define EPS2 1e-8
#define PI acos(-1.0)
using namespace std;
const int MOD = INF + 7;
const int base = 2;
int prefSum[2000][2000];
int prefSum2[2000][2000];
int prefSum3[2000][2000];
int a[2000][2000];
int b[2000][2000];
int c[2000][2000];
int sum(int x1 , int y1 , int x2 , int y2)
{
	int ans = prefSum[x2][y2];
	if(x1 && y1)
		ans += prefSum[x1 - 1][y1 - 1];
	if(x1)
		ans -= prefSum[x1 - 1][y2];
	if(y1)
		ans -= prefSum[x2][y1 - 1];
	return ans;
}
int sum2(int x1 , int y1 , int x2 , int y2)
{
	int ans = prefSum2[x2][y2];
	if(x1 && y1)
		ans += prefSum2[x1 - 1][y1 - 1];
	if(x1)
		ans -= prefSum2[x1 - 1][y2];
	if(y1)
		ans -= prefSum2[x2][y1 - 1];
	return ans;
}
int sum3(int x1 , int y1 , int x2 , int y2)
{
	int ans = prefSum3[x2][y2];
	if(x1 && y1)
		ans += prefSum3[x1 - 1][y1 - 1];
	if(x1)
		ans -= prefSum3[x1 - 1][y2];
	if(y1)
		ans -= prefSum3[x2][y1 - 1];
	return ans;
}
int q , n , m;
int main()
{
	scanf("%d %d %d" , &n , &m , &q);
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			scanf("%1d" , &a[i][j]);
			if(i && a[i][j] && a[i - 1][j])
				b[i][j]++;
			if(j && a[i][j] && a[i][j - 1])
				c[i][j]++;
		}
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if(!j)
			{
				prefSum[i][j] = a[i][j];
			}
			else
			{
				prefSum[i][j] = prefSum[i][j - 1] + a[i][j];
			}
		}
	}
	for(int i = 0; i < m; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(j)
			{
				prefSum[j][i] = prefSum[j][i] + prefSum[j - 1][i];
			}
		}
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if(!j)
			{
				prefSum2[i][j] = b[i][j];
			}
			else
			{
				prefSum2[i][j] = prefSum2[i][j - 1] + b[i][j];
			}
		}
	}
	for(int i = 0; i < m; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(j)
			{
				prefSum2[j][i] = prefSum2[j][i] + prefSum2[j - 1][i];
			}
		}
	}
	for(int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{
			if(!j)
			{
				prefSum3[i][j] = c[i][j];
			}
			else
			{
				prefSum3[i][j] = prefSum3[i][j - 1] + c[i][j];
			}
		}
	}
	for(int i = 0; i < m; i++)
	{
		for(int j = 0; j < n; j++)
		{
			if(j)
			{
				prefSum3[j][i] = prefSum3[j][i] + prefSum3[j - 1][i];
			}
		}
	}

	for(int i = 0; i < q; i++)
	{
		int X1 , Y1 , X2 , Y2;
		scanf("%d %d %d %d" , &X1 , &Y1 , &X2 , &Y2);
		X1--;Y1--;X2--;Y2--;
		int ans = sum(X1 , Y1 , X2 , Y2);
		//cout << ans << endl;
		int ans2 = sum2(X1 + 1 , Y1 , X2 , Y2);
		int ans3 = sum3(X1 , Y1 + 1 , X2 , Y2);
		printf("%d\n" , ans - ans2 - ans3);
	}
}


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

int main() {
  int X;
  cin >> X;
  
  while (true) {
    int n = sqrt(X);
    bool ok = true;
    for (int i = 2; i <= n; i++) {
      if (X % i == 0) {
        ok = false;
        break;
      }
    }
    if (ok) {
      cout << X << endl;
      break;
    }
    X++;
  }
  
  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,K,Q;
  cin >> N >> K >> Q;
  vector<int> A(Q);
  vector<int> Ans(N);
  rep(i,Q){
    cin >> A.at(i);
  }
  rep(i,Q){
    Ans.at(A.at(i)-1)++;
  }
  rep(i,N){
    if(K>Q-Ans.at(i)){
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }
}

Measured memory_bytes: 1408
trial = int(input())
for t in range(trial):
    targ = int(input())
    cnt = 0
    while True:
        if targ < 10:
            print(cnt)
            break
        else:
            maxtarg = 0
            for word in range(1,len(str(targ))):
                maxtarg = max( maxtarg , int(str(targ)[0:word]) * int(str(targ)[word:len(str(targ))]))
            targ = maxtarg
            cnt += 1

Measured memory_bytes: 7672
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    double a,b,x,tan,pi=3.141592653589793238462643383279;
    cin>>a>>b>>x;
    if((a*a*b)/2<x){tan=(2*b-(2*x/(a*a)))/a;}
    else{tan=(a*b*b)/(2*x);}
    cout<<std::setprecision(8)<<180*atan(tan)/pi;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <string>
#include <cstdio>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

#define FALSE printf("false\n");
#define TRUE printf("true\n");
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i = 0;i < ((int)(n));++i)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define test(a) cout<<"line:"<<__LINE__<<"["<<(#a)<<": "<<(a)<<"]"<<endl

const int INF = 1e9+7;
const ll INFL = 9*1e18;

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

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

#define SUM(vec) accumulate(all(vec),0LL) // 配列の中身を全部足す
template<typename T>void print(T&& x){cout<<x<<endl;}// 改行付き出力
ll inline digit(ll num){int tmp = 0;while(num){tmp++;num/=10;}return tmp;} // 桁数
template<typename T>inline T digitSum(T num){T sum = 0;while(num){sum+=num%10;num/=10;}return sum;} // 各桁の和
template<typename T>inline T gcd(T a,T b){if(b == 0)return a;return gcd(b,a%b);} // 最大公約数
template<typename T>inline T lcm(T a, T b){T g = gcd(a,b);return a/g*b;} // 最小公倍数
template<typename T>inline T power(T a,T b){T tmp=1;rep(i,b){tmp*=a;}return tmp;} // 累乗
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; }
int ctoi(char c){return c-'0';}

// TODO: write
int main() {
  int h,w;cin>>h>>w;
  vector<string> s(h);rep(i,h)cin>>s[i];
  rep(i,h){
    print(s[i]);
    print(s[i]);
  }
  return 0;
}



Measured memory_bytes: 256
require 'pp'

# Nと空白区切の入力値を数値の配列で返却する
def gets_n_and_i_list()
  return gets.chomp.to_i, gets.chomp.split(" ").map(&:to_i)
end

N, d_list = gets_n_and_i_list

f_half_index = N/2 - 1
l_half_index = f_half_index + 1

d_list.sort!
ans = d_list[l_half_index] - d_list[f_half_index]

puts ans > 0 ? ans : 0

Measured memory_bytes: 9720
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#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 long double ld;
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

const int MAX_N = 10000;
const int MAX_E = 10000;
struct edge{ ll from, to, cost; };
edge es[MAX_E]; //辺
ll d[MAX_N]; //最短距離
ll n,m; //頂点数、辺数

bool bellmanford(int s){
    rep(i,n) d[i] = INF;
    d[0] = 0;
    rep(i,n){
        bool update = false;
        rep(j,m){
            edge e = es[j];
            if (d[e.from] == INF) continue;
            if (d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if (!update) break;
    }

    bool negative[MAX_N];
    rep(i,n) negative[i] = false;
    rep(i,n) {
        rep(j,m){
            edge e = es[j];
            if (d[e.from] == INF) continue;
            if (d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                negative[e.to] = true;
            if (negative[e.from]) negative[e.to] = true;
            }
        }
    }
    if (negative[n-1]) return false;
    return true;
}

int main(){
    cin >> n >> m;
    ll a,b,c;
    rep(i,m){
       cin >> a >> b >> c;
       edge e = {a-1,b-1,-c};
       es[i] = e;
    }
    bool t = bellmanford(0);
    if (t){
        cout << -d[n-1] << endl;
    }else{
        cout << "inf" << endl;
    }

}




Measured memory_bytes: 256
using System;
using System.Text;

namespace ITP1_7_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int r = int.Parse(input[0]);
            int c = int.Parse(input[1]);
            int[] sumRArr = new int[c + 1];
            StringBuilder sb = new StringBuilder();
            for(int i = 0; i < r; i++)
            {
                int[] nums = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
                int sumC = 0;
                for(int j = 0; j < c; j++)
                {
                    sb.Append(nums[j] + " ");
                    sumC += nums[j];
                    sumRArr[j] += nums[j];
                }
                sb.AppendLine(sumC.ToString());
                sumRArr[c] += sumC;
            }

            for(int i = 0; i < c; i++)
            {
                sb.Append(sumRArr[i] + " ");
            }
            sb.AppendLine(sumRArr[c].ToString());
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9512
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<vector<pair<int, ll>>> tr(n);
	rep(i, n-1){
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		tr.at(a).push_back(make_pair(b, c));
		tr.at(b).push_back(make_pair(a, c));
	}
	int q, k;
	cin >> q >> k;
	k--;
	vector<ll> di(n, -1);
	queue<pair<ll, ll>> qq;
	qq.push(make_pair(k, 0)); di.at(k) = 0;
	while(!qq.empty()){
		auto p = qq.front(); qq.pop();
		for(auto add : tr.at(p.first)){
			if(di.at(add.first) == -1){
				di.at(add.first) = p.second + add.second;
				qq.push(make_pair(add.first, p.second + add.second));
			}
		}
	}

	rep(i, q){
		int x, y;
		cin >> x >> y;
		x--; y--;
		cout << di.at(x)+di.at(y) << endl;
	}

	return 0;
}

Measured memory_bytes: 10736
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
using std::cin; using std::cout;
using std::endl;
using std::bitset; using std::map;
using std::queue; using std::priority_queue;
using std::set; using std::string;
using std::stringstream; using std::vector;
using std::pair; using std::make_pair;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<ULL, ULL> puu;
#ifdef DEBUG
using std::cerr;
#define pass cerr << "[" << __FUNCTION__ << "] : line = " << __LINE__ << endl;
#define display(x) cerr << #x << " = " << x << endl;
#define displaya(a, st, n)                      \
	{                                           \
		cerr << #a << " = {";                   \
		for (int qwq = (st); qwq <= (n); ++qwq) \
			if (qwq == (st))                    \
				cerr << a[qwq];                 \
			else                                \
				cerr << ", " << a[qwq];         \
		cerr << "}" << endl;                    \
	}
#define displayv(a) displaya(a, 0, (int)(a.size() - 1))
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#include <ctime>
class MyTimer {
	clock_t st;
public:
	MyTimer() { cerr << std::fixed << std::setprecision(0); reset(); }
	~MyTimer() { report(); }
	void reset() { st = clock_t(); }
	void report() {  cerr << "Time consumed: " << (clock() - st) * \
		1e3 / CLOCKS_PER_SEC << "ms" << endl; }
} myTimer;
#else
#define cerr if(false) std::cout
#define pass ;
#define display(x) ;
#define displaya(a, st, n) ;
#define displayv(a) ;
#define eprintf(...) if(0) fprintf(stderr, __VA_ARGS__)
class MyTimer {
public: void reset() {} void report() {}
} myTimer;
#endif

template<typename A, typename B>
std::ostream& operator << (std::ostream &cout, const pair<A, B> &x) {
	return cout << "(" << x.first << ", " << x.second << ")";
}
template<typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }

int main() {
	std::ios::sync_with_stdio(false);
	int n; cin >> n;
	cout << n * (n - 1) / 2 - n / 2 << endl;
	if(n & 1) {
		for(int i = 1; i <= n; ++i) {
			for(int j = i + 1; j <= n; ++j) {
				if(!(i + j == n))
					cout << i << ' ' << j << '\n';
			}
		}
	} else {
		for(int i = 1; i <= n; ++i) {
			for(int j = i + 1; j <= n; ++j) {
				if(!(i + j == n + 1))
					cout << i << ' ' << j << '\n';
			}
		}
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

/**
 * ??????????????¢????????§???????????????</br>
 *
 * ????????????????????????????????¨???????????????????????????????????¨?????????</br>
 * ??¨????????????????????????????????¨?????§?????????????????????????????????????????°????????????????????¨??§?????????
 *
 * @author ?????????????????§???
 * @version 1.8_45
 */
public class Main{
	/*
	 * ????????°???????????¨?????????????????????
	 */
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		while (true) {

			// ??????????????????????????°
			int gems = sc.nextInt();
			// ????????????????????????
			if (gems == 0)
				break;

			// ????????????????§????????????????
			boolean[][] map = new boolean[21][21];
			for (int cnt = 0; cnt < gems; cnt++) {
				// ???????????????
				map[sc.nextInt()][sc.nextInt()] = true;
			}

			// ??????????????°
			int order = sc.nextInt();
            int land_r = 10;
            int land_c = 10;
            for (int cnt = 0; cnt < order; cnt++) {
                String dir = sc.next();
                int d = sc.nextInt();
                int dx = 0;
                int dy = 0;
                if ("N".equals(dir)) {
                    dy = 1;
                } else if ("S".equals(dir)) {
                    dy = -1;
                } else if ("E".equals(dir)) {
                    dx = 1;
                } else {
                    dx = -1;
                }
                for (int j = 0; j < d; j++) {
                	land_r += dx;
                	land_c += dy;
                    if (map[land_r][land_c] == true) {
                    	map[land_r][land_c] = false;
                    }
                }
            }
            boolean ans = true;
            for (int rowIndex = 0; rowIndex < map.length; rowIndex++) {
            	for (int colIndex = 0; colIndex < map.length; colIndex++) {
            		if(map[rowIndex][colIndex])
            			ans = false;
				}
			}
            System.out.println(ans ? "Yes" : "No");
		} // while?????????????????????
			// ????????????????????????
		sc.close();
	}// ?????????????????????????????????

}// ??????????????????????????????

Measured memory_bytes: 44572
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

long long calc(long long N, long long A, long long B, long long C, long long D, map<long long, long long>& Memo) {
	if (N == 0ll) return 0ll;
	if (N == 1ll) return D;
	if (Memo.find(N) != Memo.end()) return Memo[N];
	vector<long long>next = { N / 2ll, (N + 1ll) / 2ll, N / 3ll, (N + 2ll) / 3ll, N / 5ll, (N + 4ll) / 5ll };
	vector<long long>P = { 2ll,2ll,3ll,3ll,5ll,5ll };
	vector<long long>Q = { A,A,B,B,C,C };
	vector<long long>Ans(6);
	for (int i = 0; i < 6; i++) {
		Ans[i] = D * abs(N - next[i] * P[i]) + Q[i] + calc(next[i], A, B, C, D, Memo);
		if (i == 0) Memo[N] = Ans[i];
		Memo[N] = min(Memo[N], Ans[i]);
	}
	if (log(Memo[N]) >= log(N)+log(D)) Memo[N] = min(Memo[N], D * N);
	return Memo[N];
}

//see answer
int main() {
	int T;
	cin >> T;
	vector<long long>Ans(T);
	for (int t = 0; t < T; t++) {
		long long N, A, B, C, D;
		cin >> N >> A >> B >> C >> D;
		map<long long, long long> Memo;
		Ans[t]=calc(N, A, B, C, D, Memo);
	}
	for (long long a : Ans) cout << a << endl;
}


Measured memory_bytes: 4620
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;
 
 
 
int main(){
  int N;
  while(~scanf("%d",&N)){
    if(N==0) break;
 
    vector<int> row;
    vector<int> col;
    for(int i=0;i<N;i++){
      int num;
      cin >> num;
      row.push_back(num);
    }
 
    for(int i=0;i<N;i++){
      int num;
      cin >> num;
      col.push_back(num);
    }
    sort(col.begin(),col.end(),greater<int>());
 
    bool isok = true;
    for(int i=0;i<col.size();i++){           
      for(int j=0;j<row.size();j++){
	if(row[j] > 0){
	  col[i]--;
	  row[j]--;
	}
      }
    }
 
    if(count(col.begin(),col.end(),0) != col.size()
       || count(row.begin(),row.end(),0) != row.size()){
      isok = false;
    }
 
    printf("%s\n",isok ? "Yes" : "No");
  }
}

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

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;


int main(){
    int aa,bb,m;
    std::cin >> aa>>bb>>m;
    VEC(int,a,aa);
    VEC(int,b,bb);
    itn ans=INF;
    rep(i,m){
        int x,y,c;
        std::cin >> x>>y>>c;
        chmin(ans,a[x-1]+b[y-1]-c);
    }
    sort(all(a));
    sort(all(b));
    chmin(ans,a[0]+b[0]);
    std::cout << ans << std::endl;
}


Measured memory_bytes: 1152
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
using Graph = vector<vector<int>>;
typedef long long ll;
const int mod =1e+9+7;

int main(){
    ll a,b,c; cin>>a>>b>>c;
    map<ll,ll>mp;
    mp[a]++;
    mp[b]++;
    mp[c]++;
    ll ans=0;
    for(auto p:mp){
        ans++;
    }
    cout<<ans<<endl;
}





























































































Measured memory_bytes: 3624