akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//    #pragma GCC optimize("unroll-loops")
//    #pragma GCC optimize("Ofast")
//    #pragma GCC optimize("-O3")
//    #pragma GCC optimize("no-stack-protector")
//    #pragma GCC optimize("fast-math")
//#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifndef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fi first
#define f first
#define se second
#define s second
#define vi_a vector<int>a;
#define p_b push_back
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ll long long
typedef unsigned long long ull;
////////////////////////////////???????????????CHECK THIS OUT???????????????//////////////////////////////
#define ld long double
#define pll pair<ll,ll>
#define pii pair<int,int>
#define m_p make_pair
#define fast_io cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
#define all(x) x.begin(),x.end()
#define getfiles    ifstream cin("input.txt");ofstream cout("output.txt");
#define pw(x) (1ll << x)
#define sz(x) (int)x.size()
#define endl "\n"
#define rall(x) x.rbegin(),x.rend()
#define len(a) (ll)a.size()
#define rep(x,l,r) for(ll x=l;x<r;x++)

//using namespace __gnu_pbds;
ld eps = (ld)1 / 1e6;
const ld pi=3.14159265359;
ll inf = 1e18,mod1=1e9+7;
ll sqr(ll a) { return a * a; }
ll qb(ll a) { return a * a * a; }
ll gcd(ll a, ll b) { return !a ? b : gcd(b % a, a); }
ll binpow(ll a, ll b, ll mod) { return b ? (b % 2 ? (a * (sqr(binpow(a, b / 2, mod)) % mod)) % mod : sqr(binpow(a, b / 2, mod)) % mod) : 1; }
ll binmult(ll a, ll b, ll mod) { return b ? (b % 2 ? (2 * binmult(a, b / 2, mod) + a) % mod : (2 * binmult(a, b / 2, mod)) % mod) : 0; }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
const ll R=1e4;
const ll tx[4]={0,0,-1,1};
const ll ty[4]={-1,1,0,0};
const char rev_to[4]={'E','W','N','S'};
const int N=2e3+1;
const int M=1e9+7;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> st;
auto rnd=bind(uniform_int_distribution<ll>(1,125),mt19937(time(0)));
void bad(){
    cout<<-1;
    exit(0);
}

signed main()
{
    fast_io;
    int x;
    cin>>x;
    cout<<ceil((ld)(2000-x)/200);
    return 0;
}
/*
0 0 0
2 1 3
3 2 7
1 3 8
1 4 2
3 5 3

/
*/


Measured memory_bytes: 3812
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	for bit := 0; bit < (1 << uint(len(s)-1)); bit++ { // '+'/'-'を入れる位置でbit全探索
		sum, _ := strconv.Atoi(s[0:1])
		ans := s[0:1]
		for j := 0; j < len(s)-1; j++ {
			v, _ := strconv.Atoi(s[j+1 : j+2])
			if bit&(1<<uint(j)) != 0 {
				sum += v
				ans += "+"
			} else {
				sum -= v
				ans += "-"
			}
			ans += s[j+1 : j+2]
		}
		if sum == 7 {
			fmt.Println(ans + "=7")
			return
		}
	}
}


Measured memory_bytes: 512
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var K = cin.ReadInt;
            var D = cin.ReadIntArray(K);
            for (int i = N; i < 100000; ++i)
            {
                var n = i.ToString();
                var flag = true;
                for (int j = 0; j < n.Length; ++j)
                {
                    if (D.Contains((int)(n[j] - '0'))) flag = false;
                }
                if (flag) { WriteLine(i); return; }
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
        public void ReadIntArrays(long N, out int[] A, out int[] B) { A = new int[N]; B = new int[N]; for (long i = 0; i < N; ++i) { A[i] = ReadInt; B[i] = ReadInt; }}
    }
}


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

#define printl(s) cout << s << endl;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll = long long;
using vvi = vector<vector<int>>;

const ll modSeed = pow(10,9) + 7;
const int INF = 1'000'000'000;

template <typename T>
vector<T> getVector(ll num){
    vector<T> values(num);
    for(ll i=0;i<num;i++){
        cin >> values.at(i);
    }
    return values;
}

string S;
ll N,D,ans;

int main(){
  ans = 0;
  cin >> N;
  for(int i=1;i<=N;i++){
    int pay = i * 1.08;
    if(pay==N){
      printl(i);
      return 0;
    }
  }
  printl(":(");
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

void solve(long long N, std::vector<long long> A){
    sort(A.rbegin(),A.rend());
    ll ans =A[0];
    int half = N/2;
    for(int i=1;i<half;i++){
        ans += A[i]*2;
    }
    if(N%2==1){
        ans += A[half];
    }
    cout << ans << endl;

}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 4840
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cstdlib>
#include<ctime>
#include<cmath>

using namespace std;
typedef long long LL;
int a[100050],n,x,y;

int main(){
	
	int i,j,k;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&a[i]);
		if(a[i]%4==0)x++;
		else if(a[i]%2==0)y++;
	}
	n-=max(y-1,0);
	printf("%s",x>=n/2?"Yes":"No");

	return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;

int main() {
  char buf[80];
  int n, d;
  map<int, P> m;
  map<int, P>::iterator it;
  while (fgets(buf, sizeof(buf), stdin) && (sscanf(buf, "%d,%d", &n, &d)==2)) {
    if ((it = m.find(n)) == m.end()) {
      m.insert(pair<int, P>(n, P(1, 1)));
    } else {
      ++(it->second.first);
    }
  }
  while (fgets(buf, sizeof(buf), stdin) && (sscanf(buf, "%d,%d", &n, &d)==2)) {
    if ((it = m.find(n)) != m.end()) {
      ++(it->second.first);
      ++(it->second.second);
    }
  }
  for (it=m.begin(); it!=m.end(); it++) {
    if (it->second.second > 1) {
      printf("%d %d\n", it->first, it->second.first);
    }
  }
  return 0;
}

Measured memory_bytes: 1044
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const int inf = 1e9;
const ll INF = 1e18;
const double pi = 3.14159265358979323846;
#define rep(i,n) for(ll i=0;i<n;i++)
using Graph = vector<vector<int>>;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};

int main(){
    int h,w;cin>>h>>w;
    char g[h][w];
    queue<pair<int,int>> q;
    int dist[h][w];
    rep(i,h) rep(j,w) {
        cin>>g[i][j];
        if(g[i][j]=='#') {
            q.push(make_pair(i,j));
            dist[i][j]=0;
        }
        else dist[i][j]=-1;
    }


    while(!q.empty()){
        int y=q.front().first;
        int x=q.front().second;
        q.pop();
        rep(i,4){
            int ny=y+dy[i],nx=x+dx[i];
            if(ny>=0&&ny<h&&nx>=0&&nx<w&&g[ny][nx]=='.'&&dist[ny][nx]==-1){
                dist[ny][nx]=dist[y][x]+1;
                q.push(make_pair(ny,nx));
            }
        }
    }
    int ans=0;
    rep(i,h) rep(j,w) ans=max(ans,dist[i][j]);
    
    cout<<ans<<"\n";
}


Measured memory_bytes: 13328
#include <bits/stdc++.h>
using namespace std;
int a[150];
int n,p,k;

double sum,s;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin>>n;
for(int i=0;i<n;i++){
    cin>>a[i];
    s+=a[i];
}
sort(a,a+n);
sum = round(s/n);
for(int i=0;i<n;i++){
    k=abs(a[i]-sum);
    p+=pow(k,2);
}
cout<<p;

return 0;}



Measured memory_bytes: 3672
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    String X;
    String Y;
    int c0 = 0;
    int c1 = 0;
    
    for(int i=0; i< S.length(); i++) {
      if(i%2 == 0) {
        X = "0";
        Y = "1";
      } else {
        X = "1";
        Y = "0";
      }
      if(!S.substring(i, i+1).equals(X)) {
        c0++;
      } else {
        c1++;
      }
    }
    if(c0<c1) {
      System.out.println(c0);
    } else {
      System.out.println(c1);
    }
  }
}

Measured memory_bytes: 30400
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>

int main(){
    int N, K;
    std::string S;

    std::cin >> N >> K;
    std::cin >> S;

    S[K-1]=S[K-1]+0x20;

    std::cout << S << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>
#include <queue>
using namespace std;
typedef long long int ll;

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll a,b,k; cin >> a >> b >> k;
	ll p=min(a,k);
	a-=p;
	k-=p;
	b-=min(b,k);
	cout << a << " " << b << endl;
}

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

struct Node { int to, cost; };

void dfs(int v, int par, long long dist, vector<long long>& d, const vector<vector<Node>>& g)
{
    d[v] = dist;
    for (int i = 0; i < g[v].size(); i++) {
        if (g[v][i].to == par) continue;
        dfs(g[v][i].to, v, dist + g[v][i].cost, d, g);
    }
}
int main()
{
    int N;
    cin >> N;

    vector<vector<Node>> g(N);
    for (int i = 0; i < N - 1; i++) {
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        g[a].push_back({b, c});
        g[b].push_back({a, c});
    }

    int Q, K;
    cin >> Q >> K;
    --K;

    vector<long long> cost(N);
    dfs(K, -1, 0, cost, g);

    for (int i = 0; i < Q; i++) {
        int x, y;
        cin >> x >> y;
        --x, --y;
        cout << cost[x] + cost[y] << endl;
    }

    return 0;
}


Measured memory_bytes: 15872
/**
*    created: 24.07.2020 14:26:02
**/
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using bint = boost::multiprecision::cpp_int;
using namespace std;
#define int 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++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define pcnt(bit) __builtin_popcountll(bit)
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 (b < a) {a = b; return 1;} return 0;}
const long double pi = acos(-1.0);
const int MAX = 1000010;
const int INF = 1LL << 60;
const int MOD = 1000000007;
// const int MOD = 998244353;

signed main() {

    cin.tie(0);
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    vector<int> v(n+1);
    rep(i,n) cin >> v[i+1];
    vector<int> ans(n+1);
    for (int i = n; i >= 1; i--) {
        int cnt = 0;
        for (int j = i; j <= n; j += i) {
            if (j == i) continue;
            cnt += ans[j];
        }
        cnt %= 2;
        if (v[i] != cnt) ans[i]++;
    }
    vector<int> out;
    rep(i,n) if (ans[i+1] == 1) out.push_back(i+1);
    cout << out.size() << endl;
    int t = out.size();
    rep(i,t) {
        if (i == 0) cout << out[i];
        else cout << " " << out[i];
    } 
    cout << endl;
    return 0;
}

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

int main()
{
  string s;
  int map[26] = {0};
  while (getline(cin, s)) {
  // while (scanf("%s", s)!=EOF) {
    transform(s.begin(), s.end(), s.begin(), ::tolower);

    rep(i, s.size()) {
      map[s[i]-'a'] ++;
    }
  }

  rep(i, 26) {
    printf("%c : %d\n", 97+i, map[i]);
  }
  return 0;
}


Measured memory_bytes: 3248
#include<stdio.h>
long long int l[200005], r[200005], d[200005];
long long int seg[800005], lazy[800005], mseg[800005], ss;
long long int p = 998244353;
long long int max(long long int a, long long int b)
{
	if (a > b)
		return a;
	else
		return b;
}
void set0(long long int x)
{
	if (2 * x + 2 < 2 * ss - 1)
	{
		lazy[2 * x + 1] = max(lazy[2 * x + 1], lazy[x]);
		lazy[2 * x + 2] = max(lazy[2 * x + 2], lazy[x]);
	}
	if (lazy[x] > 0)
		seg[x] = mseg[x] * d[lazy[x]] % p;
	lazy[x] = 0;
}
void set(long long int l, long long int r, long long int v, long long int k, long long int left, long long int right)
{
	set0(k);
	if (right <= l || r < left)
		return;
	if (l <= left && right <= r + 1)
	{
		lazy[k] = v;
		set0(k);
		return;
	}
	set(l, r, v, 2 * k + 1, left, (left + right) / 2);
	set(l, r, v, 2 * k + 2, (left + right) / 2, right);
	seg[k] = (seg[2 * k + 1] + seg[2 * k + 2]) % p;
	return;
}
long long int get(long long int l, long long int r, long long int k, long long int left, long long int right)
{
	set0(k);
	if (right <= l || r < left)
		return 0;
	if (l <= left && right <= r + 1)
		return seg[k];
	return (get(l, r, 2 * k + 1, left, (left + right) / 2) + get(l, r, 2 * k + 2, (left + right) / 2, right)) % p;
}
int main()
{
	long long int n, q;
	scanf("%lld %lld", &n, &q);
	long long int i;
	for (i = 0; i < q; i++)
	{
		scanf("%lld %lld %lld", &l[i + 1], &r[i + 1], &d[i + 1]);
		l[i + 1]--;
		r[i + 1]--;
	}
	l[0] = 0;
	r[0] = n - 1;
	d[0] = 1;
	ss = 1;
	while (ss < n)
		ss *= 2;
	for (i = 0; i < 2 * ss - 1; i++)
		seg[i] = lazy[i] = mseg[i] = 0;
	mseg[n - 1 + ss - 1] = 1;
	for (i = n - 1 + ss - 2; i >= ss - 1; i--)
		mseg[i] = 10 * mseg[i + 1] % p;
	for (i = ss - 2; i >= 0; i--)
		mseg[i] = (mseg[2 * i + 1] + mseg[2 * i + 2]) % p;
	for (i = 0; i < 2 * ss - 1; i++)
		seg[i] = mseg[i];
	for (i = 1; i <= q; i++)
	{
		set(l[i], r[i], i, 0, 0, ss);
		printf("%lld\n", get(0, n - 1, 0, 0, ss));
	}
	return 0;
}

Measured memory_bytes: 19324
N, M = [int(v) for v in input().split()]

S = []
for i in range(M):
    S.append(set([int(v) for v in input().split()][1:]))
P = [int(v) for v in input().split()]

limit = int('1' * N, 2)
res = 0
for j in range(limit + 1):
    on_idx = set()
    for ki, k in enumerate(list(('{:0' + str(N) + 'b}').format(j))):
        if k == '1':
            on_idx.add(ki+1)

    cnt = 0
    for i in range(M):
        cnt += int(len(S[i].intersection(on_idx)) % 2 == P[i])

    if cnt == M:
        res += 1
print(res)


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

char get_char(int i){
    return  char((int)'a'+ i);
}
int unique_char(string a ){
    set<char> set_c;
    int count = 0;
    for (char c : a){
        if (set_c.count(c) == 0){
            set_c.insert(c);
            count++;
        }
    }
    return count;
}


void solve(int N){
    priority_queue<string,vector<string>,greater<string>> cand;
    queue<string> next;
    next.push("a");
    while(next.front().size()<N){
        string a = next.front();
        int len = a.size();
        next.pop();
        int unique_char_count = unique_char(a);
        for (int i=0;i<=unique_char_count;i++){
            string b = a;
            string c = a;
            b.push_back(get_char(i));
            c.push_back(get_char(i));
            next.push(c);
            if (b.size()==N){
                cand.push(b);
            }
        }
    }
    if (N==1){
        cand.push("a");
    }
    while(!cand.empty()){
        cout << cand.top() << endl;
        cand.pop();
    }

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    int N;
    scanf("%d",&N);
    solve(N);
    return 0;
}


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

public class Main {
	static int par[]=new int[200007];
	static int root(int x)
	{
		if(par[x]==x)return x;
		
		return par[x]=root(par[x]);
	}
	static void unite(int x,int y)
	{
		x=root(x);
		y=root(y);
		par[x]=y;
		
	}
	public static void main(String args[])
	{
		Scanner scan=new Scanner(System.in);
		int n=scan.nextInt();
		int m=scan.nextInt();
		int ar[]=new int[n+2];
		for(int i=1;i<=n;i++)
		{
			ar[i]=scan.nextInt();
		}
		for(int i=0;i<par.length;i++)
		{
			par[i]=i;
		}
		for(int i=0;i<m;i++)
		{
			unite(scan.nextInt(),scan.nextInt());
		}
		boolean gg[]=new boolean[n+2];
		for(int i=1;i<=n;i++)
		{
			if(root(i)==root(ar[i]))
			{
				gg[i]=true;
			}
		}
		int count=0;
		for(int i=1;i<=n;i++) {
			if(gg[i])count++;
		}
		System.out.println(count);
		
		
	}
}


Measured memory_bytes: 96592
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

#define MOD 1000000007;

int main(){
	string s;
	cin >> s;
	int num1=0, num2=0;
	for(int i=0; i<s.size(); i++){
		if(i%2 && s[i]=='0' || !(i%2) && s[i]=='1')
			num1++;
	}
	for(int i=0; i<s.size(); i++){
		if(i%2 && s[i]=='1' || !(i%2) && s[i]=='0')
			num2++;
	}
	cout << min(num1,num2) << endl;
	return 0;
}

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


int cnt[432];
vector<int> points;
vector<vector<int> > anses;
multiset<int> dists;


bool rem(int x){
	if(dists.count(x) == 0)return false;
	dists.erase(dists.find(x));
	return true;
}

void ins(int x){
	dists.insert(x);
}

void addans(){
	vector<int> tmp = points;
	vector<int> ans;
	sort(tmp.begin(), tmp.end());
	for(int i = 1;i < tmp.size();i++){
		ans.push_back(tmp[i] - tmp[i-1]);
	}
	anses.push_back(ans);
}

void check(int l);

void go(int l){
	if(dists.empty()){
		addans();
		return;
	}
	int longest = *dists.rbegin();
	points.push_back(longest);
	check(l);
	points.pop_back();
	points.push_back(l - longest);
	check(l);
	points.pop_back();
}


void check(int l){
	int tmp = points.back();
	int i;
	bool ok = true;
	for(i = 0;i < points.size();i++){
		if(i+1 == points.size())break;
		int dist = abs(points[i] - tmp);
		if(!rem(dist)){
			ok = false;
			i;
			break;
		}
	}
	if(ok)go(l);
	i--;
	for(;i >= 0;i--){
		int dist = abs(points[i] - tmp);
		ins(dist);
	}
}


void solve(int n){
	int a;
	anses.clear();
	dists.clear();
	points.clear();
	for(int i = 0;i < n *(n-1) /2;i++){
		cin >> a;
		dists.insert(a);
	}
	int length = *dists.rbegin();
	rem(length);
	points.push_back(0);
	points.push_back(length);
	go(length);
	sort(anses.begin(), anses.end());
	anses.erase(unique(anses.begin(), anses.end()), anses.end());
	for(int i = 0;i < anses.size();i++){
		for(int j = 0;j < n-1;j++){
			if(j)cout << " ";
			cout << anses[i][j];
		}cout << endl;
	}
	cout << "-----" << endl;
}



int main(){
	int n;
	while(true){
		cin >> n;
		if(n == 0)break;
		solve(n);
	}
	return 0;
}

Measured memory_bytes: 1300
import sys

sys.setrecursionlimit(500005)
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()

n = ni()
s = ns()

# RRRWWW
w2r = 0
r2w = s.count("R")
ans = 999999999
for i in range(n+1):
    ans = min(ans, max(w2r, r2w))
    if i < n:
        if s[i] == "W":
            w2r += 1
        else:
            r2w -= 1

print(ans)


Measured memory_bytes: 67900
#include<iostream>
using namespace std;
 
int main(){
  int n,m;
  cin >> n >> m;
  int a[m],b[m];
  for(int i=0;i<m;i++) cin >> a[i] >> b[i];
  int ans[n]={};
  for(int i=0;i<m;i++){
    ans[a[i]-1]++;
    ans[b[i]-1]++;
  }
  for(int i=0;i<n;i++) cout << ans[i] << endl;  
}

Measured memory_bytes: 256
H,W = gets.split.map(&:to_i)
As = H.times.map{gets.chomp.chars}
As.each do |a|
    a.unshift("#")
    a.push("#")
end
As.unshift(("#"*(W+2)).chars)
As.push(("#"*(W+2)).chars)
As.each do |a|
    puts a.join
end

Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
  cin>>n;
  vector<int >nos(3*n,0);
  for(int i=0;i<3*n;i++)cin>>nos[i];
  sort(nos.rbegin(),nos.rend());
  long long sum=0;
  int count=0;
  for(int i=1;i<3*n && count<n;i+=2,count++)sum+=nos[i];
  cout<<sum;
}

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

int main() {
  int N ,count = 0;
  string S;
  cin >> N;
  cin >> S;

  //rep(i, N) { N-1かN番目に'A'があったらN+1かN+2番目まで操作を行ってしまう
  rep(i ,N-2){
    if(S.at(i) == 'A' && S.at(i+1) == 'B' && S.at(i+2) == 'C'){
    count++;
    }
    }
  cout << count << endl;
  return 0;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>

#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n;i++)
#define repf(i, a, b) for (int i = (int)a; i < (int)b;i++)
#define repv(x, arr) for (auto& x:arr)
#define all(v) (v).begin(), (v).end()
#define vec(name, num) vector<ll> name((num), 0);
#define mp(a,b) make_pair(a,b)
#define op(i) cout << (i) << endl;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;

const ll mod = 1e9 + 7;



int main(){
    string a, b, c;
    cin >> a >> b >> c;
    cout << a[0] << b[0] << c[0] << endl;
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::str::FromStr;

// ringos-favorite-numbers.rs --- Ringo's Favorite Numbers
// author: Seong Yong-ju <sei40kr@gmail.com>

#[allow(unused_macros)]
macro_rules! get {
  ($t:ty) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.trim().parse::<$t>().unwrap()
    }
  };
  ($($t:ty),*) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      let mut iter = line.split_whitespace();
      (
        $(iter.next().unwrap().parse::<$t>().unwrap(),)*
      )
    }
  };
  ($t:ty; $n:expr) => {
    (0..$n).map(|_|
                get!($t)
    ).collect::<Vec<_>>()
  };
  ($($t:ty),*; $n:expr) => {
    (0..$n).map(|_|
                get!($($t),*)
    ).collect::<Vec<_>>()
  };
  ($t:ty ;;) => {
    {
      let mut line: String = String::new();
      stdin().read_line(&mut line).unwrap();
      line.split_whitespace()
        .map(|t| t.parse::<$t>().unwrap())
        .collect::<Vec<_>>()
    }
  };
  ($t:ty ;; $n:expr) => {
    (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
  };
}

#[allow(unused_macros)]
macro_rules! debug {
  ($($a:expr),*) => {
    println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
  }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("Failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("Failed to parse token")
}

#[allow(dead_code)]
fn with_bufwriter<F: FnOnce(BufWriter<StdoutLock>) -> ()>(f: F) {
    let out = stdout();
    let writer = BufWriter::new(out.lock());
    f(writer);
}

fn main() {
    let (d, n) = get!(u32, u32);

    let ans = 100u32.pow(d) * (if n == 100 { n + 1 } else { n });

    with_bufwriter(|mut out| writeln!(out, "{}", ans).unwrap());
}


Measured memory_bytes: 4352
na, nb, nm = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a_min, b_min = min(A), min(B)
min_tmp = a_min + b_min

aibjc = []
for _ in range(nm):
  ai, bj, c = list(map(int, input().split()))
  min_tmp = min(min_tmp, A[ai-1]+B[bj-1]-c)

print(min_tmp)

Measured memory_bytes: 18736
L,R=map(int, input().strip().split())

d=2018
for i in range(min(R-L,2019)):
  a=L+i
  for j in range(min(R-a,2019)):
    b=a+j+1
    c=(a*b)%2019
    if c<d:
      d=c
print(d)

Measured memory_bytes: 2940
import * as fs from 'fs';

const readString = (() => {
  const input = fs.readFileSync(0).toString();
  const words = input.split(/[ \n]/);
  let i = 0;
  return () => words[i++] || '';
})();
const readInt = () => parseInt(readString(), 10);
const readBigInt = () => BigInt(readString());

const gcd = (a: bigint, b: bigint) => {
  const _gcd = (a: bigint, b: bigint): bigint => {
    const q = a % b;
    return q === 0n ? b : _gcd(b, q);
  };
  return a > b ? _gcd(a, b) : _gcd(b, a);
};

const MOD = 1000000007;
const MOD_BIGINT = BigInt(MOD);
class ModBigInt {
  constructor(public v: bigint) {}

  static of(n: number | bigint) {
    return new ModBigInt(ModBigInt.toBigInt(n));
  }

  static toBigInt(other: number | bigint | ModBigInt) {
    if (typeof other === 'bigint') return other;
    if (typeof other === 'number') return BigInt(other);
    return other.v;
  }

  clone = () => new ModBigInt(this.v);
  plus = (other: number | bigint | ModBigInt) => {
    this.v = (this.v + ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  minus = (other: number | bigint | ModBigInt) => {
    this.v = (this.v + MOD_BIGINT - ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  multiply = (other: number | bigint | ModBigInt) => {
    this.v = (this.v * ModBigInt.toBigInt(other)) % MOD_BIGINT;
    return this;
  };
  pow = (other: number) => {
    const v = mod(1);
    for (let i = 0; i < other; i++) v.multiply(this.v);
    return v;
  };
}

const mod = ModBigInt.of;

const abs = (a: bigint) => (a > 0n ? a : -a);

(function main() {
  const H1 = readInt();
  const M1 = readInt();
  const H2 = readInt();
  const M2 = readInt();
  const K = readInt();
  console.log((H2 - H1) * 60 + (M2 - M1) - K);
})();


Measured memory_bytes: 29648
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> P;
#define pb push_back
#define ft first
#define sd second
#define mp make_pair
#define fr(i,n) for(int i=0;i<(n);i++)
#define Fr(i,n) for(int i=0;i++<(n);)
#define ifr(i,n) for(int i=(n)-1;i>=0;i--)
#define iFr(i,n) for(int i=(n);i>0;i--)

struct modint{
    ll a;
    const ll MOD=998244353;
    modint(ll a_=0){
        a=((a_%MOD)+MOD)%MOD;
    }
    modint inv()const{
        ll n=1,m=MOD-2,A=a;
        while(m){
            if(m&1)(n*=A)%=MOD;
            (A*=A)%=MOD;
            m>>=1;
        }
        modint y(n);
        return y;
    }
    bool operator==(const modint& x){
        return a==x.a;
    }
    modint& operator=(const modint& x){
        a=x.a;
        return *this;
    }
    modint operator+(const modint& x){
        modint y(a+x.a);
        return y;
    }
    modint operator-(const modint& x){
        modint y(a-x.a);
        return y;
    }
    modint operator*(const modint& x){
        modint y(a*x.a);
        return y;
    }
    modint operator/(const modint& x){
        return *this * x.inv();
    }
    modint& operator+=(const modint& x){
        *this=*this+x;
        return *this;
    }
    modint& operator-=(const modint& x){
        *this=*this-x;
        return *this;
    }
    modint& operator*=(const modint& x){
        *this=*this*x;
        return *this;
    }
    modint& operator/=(const modint& x){
        *this=*this/x;
        return *this;
    }
};
istream& operator>>(istream &in,modint& x){
    ll a_;
    in>>a_;
    modint y(a_);
    x=y;
    return in;
}
ostream& operator<<(ostream &out,const modint& x){
    out<<x.a;
    return out;
}
modint pwr(ll a,ll b){
    modint n(1),A(a);
    while(b){
        if(b&1) n*=A;
        A*=A;
        b>>=1;
    }
    return n;
}
modint fc[4010]={1};
modint fct(int n){
    if(fc[n].a) return fc[n];
    return fc[n]=modint(n)*fct(n-1);
}
modint ifc[4010]={1};
modint ifct(int n){
    if(fc[n].a) return ifc[n];
    return ifc[n]=modint(n).inv()*ifct(n-1);
}
void initfct(int n){
    ifct(n);
    ifr(i,n) ifc[i]=ifc[i+1]*(i+1);
}
modint cmb(int n,int r){
    if(n<0||r<0||n<r) return 0;
    return fct(n)*ifct(r)*ifct(n-r);
}

int main(){
    initfct(4005);
    int k,n;
    cin>>k>>n;
    modint ans[2010]={};
    for (int i = 2; i <= 2*k; ++i) {
        if(i>k+1){
            cout<<ans[2*k-i+2]<<endl;
            continue;
        }
        if(i%2){
            int p=i/2;
            fr(q,p+1) ans[i]+=pwr(2,q)*cmb(p,q)*cmb(k-2*p+n-1,n-q);
        }
        else{
            int p=i/2-1;
            fr(q,p+1) ans[i]+=pwr(2,q)*cmb(p,q)*(cmb(k-2*p+n-2,n-q)+cmb(k-2*p+n-3,n-1-q));
        }
        cout<<ans[i]<<endl;
    }
}

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

int main()
{
  int h, n;
  cin >> h >> n;
  valarray<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << (h <= a.sum() ? "Yes" : "No") << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <string>
#include <cstring>
#include <functional>

using namespace std;

// const int maxn = 
// const int mo = 1e9 + 7;


int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
    int a = 0;
    string s;
    cin >> s;

    for (int i = 0; i < s.length(); ++i)
        if (s[i] == 'A')
            ++a;
    
    if (a == 3 || a == 0)
        cout << "No" << endl;
    else
        cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
N, Q = [int(x) for x in input().split()]
S = input()
TD = []
for _ in range(Q):
    t, d = input().split()
    TD.append((t, d))


def isDead(targetIdx):
    ti = targetIdx
    for t, d in TD:
        if t == S[ti]:
            if d == 'L':
                ti -= 1
                if ti == -1:
                    return -1
            else:
                ti += 1
                if ti == N:
                    return +1
    return 0


l, t, r = 0, N // 2, N - 1

while r - l > 1:
    t = (l + r) // 2
    if isDead(t) == -1:
        l = t
    else:
        r = t

L = l
if L == 0 and isDead(0) == 0:
    L -= 1

l, t, r = 0, N // 2, N - 1

while r - l > 1:
    t = (l + r) // 2
    if isDead(t) == +1:
        r = t
    else:
        l = t

R = r
if R == N - 1 and isDead(N - 1) == 0:
    R += 1

print(R - L - 1)

# print((L, R))
# print([isDead(t) for t in range(N)])


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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template<typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if (i) os << " ";
    os << v[i];
  }
  return os;
}

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

  ll h, w;
  cin >> h >> w;

  ll ans = LINF;
  chmin(ans, w * (h % 3 != 0));
  chmin(ans, h * ((w % 3) != 0));

  FOR(i, 1, h) {
    int j = h - i;
    ll s1 = i * (w / 2);
    ll s2 = i * (w / 2 + w % 2);
    ll s3 = j * w;

    chmin(ans, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
  }

  FOR(i, 1, w) {
    int j = w - i;
    ll s1 = i * (h / 2);
    ll s2 = i * (h / 2 + h % 2);
    ll s3 = j * h;

    chmin(ans, max(s1, max(s2, s3)) - min(s1, min(s2, s3)));
  }

  cout << ans << endl;

}








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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}

ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextLong();

  map<ll, ll> count;
  ll S = 0;
  REP(i, N) {
    int a = nextLong();
    ++count[a];
    S += a;
  }

  int Q = nextLong();
  REP(_, Q) {
    ll x = nextLong();
    ll y = nextLong();

    S -= x * count[x];
    S -= y * count[y];

    count[y] += count[x];
    count[x] = 0;
    
    S += y * count[y];
    cout << S << '\n';
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 9572
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp1
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var inputArray = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();

            long X = inputArray[0];
            long K = inputArray[1];

            long left = K - X + 1;
            long right = K + X - 1;
            List<long> answer = new List<long>();
            for (long i = left; i <= right; i++)
            {
                answer.Add(i);
            }

            string ans="";
            foreach (var item in answer)
            {
                ans = ans + item + " ";
            }

            Console.WriteLine(ans.Trim());
        }
    }
}

Measured memory_bytes: 13396
#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>;

int main(){
   int N;
   cin >> N;
   string S;
   cin >> S;
   ll r=0, g=0, b=0;
   for (int i=0;i<N;i++){
      if (S.at(i)=='R') r++;
      if (S.at(i)=='G') g++;
      if (S[i]=='B') b++;
   }
   ll sum = r*g*b;

   for(int i=0;i<N-2;i++){
      for(int j=i+1;(2*j-i)<N;j++){
         int k = 2*j-i;
         if(k<N){
            if((S[k] != S[i]) and (S[k] != S[j]) and (S[i] != S[j])){
               sum--;
            }
         }
      }
   }
   cout << sum << endl;
   return 0;  
}

Measured memory_bytes: 3636
def main():
    N = int(input())
    L = list(map(int, input().split()))
    cnt = 0
    for i in range(len(L)):
        for j in range(i + 1, len(L)):
            for k in range(j + 1, len(L)):
                l = sorted([L[i], L[j], L[k]])
                if l[0] < l[1] and l[1] < l[2] and l[0] + l[1] > l[2]:
                    cnt += 1
    return cnt

if __name__ == '__main__':
    print(main())

Measured memory_bytes: 67880
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<cmath>
typedef long long int ll;
using namespace std;
int main()
{
	int n,m;
	cin >> n >> m;
	
	int x = 1900*m + 100*(n-m);
	int ans = pow(2,m);
	ans *= x;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
#define N 100000
int x[N+5],y[N+5],c[N+5],y1[N+5];
int n,k,ans,cnt;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++) 
	{
		char ch;
		scanf("%d %d %c",&x[i],&y[i],&ch);
		x[i]%=(2*k);
		y[i]%=(2*k);
		if(ch=='W')
			c[i]=1;
	}
	for(int i=0;i<=k;i++)
	{
		cnt=0;
		fill(y1,y1+2*k+1,0);
		for(int j=1;j<=n;j++)
		{
			bool p=(i<=x[j]&&x[j]<i+k);
			bool q=(0<=y[j]&&y[j]<k);
			if(p^q==c[j])
				cnt++,y1[y[j]]++;
			else
				y1[y[j]]--;
		}
		for(int j=0;j<=k;j++)
		{
			ans=max(max(cnt,n-cnt),ans);
			if(j!=k)
				cnt=cnt-y1[j]-y1[k+j];
		}
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main(int argc, char const *argv[])
{
	int n, k; cin >> n >> k;
	vector<ll> v(n); {
		rep(i, n) cin >> v[i];
	}
	sort(all(v));

	ll ans = INFF;
	rep(i, n - k + 1) {
		ans = min(ans, v[i + k - 1] - v[i]);
	}
	printf("%lld\n", ans);

	return 0;
}

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

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rept(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define reps(i,s,n) for(int (i)=(s);(i)<(int)(n);(i)++)
#define repst(i,s,n) for(int (i)=(s);(i)<=(int)(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>=0;(i)--)
#define each(itr,v) for(auto (itr):(v))
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define mp(x,y) make_pair((x),(y))
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln "\n"
#define show(x) cout << #x << " = " << x ln
#define dbg(x) cout<<#x"="<<x ln

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

const int inf = (int)1e9;
const ll linf = (ll)1e18;
const int mod = (int)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

string s;
int a[26];

int main() {
	cin >> s;
	rep(i,s.length()) a[s[i]-'a']++;
	
	string c = "abcdefghijklmnopqrstuvwxyz";
	rep(i,26) {
		if (a[i]==0) {
			cout << c[i] << ln;
			return 0;
		}
	}
	cout << "None" << ln;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
int ndiv2(int N){
    int ret = 0;
    while(N){
        if(N%2==0) {
            N/=2;
            ++ret;
        }
        else
            break;
    }
    return ret;
}

int main(){
    int N;
    cin >> N;
    int ret = 0;
    for(size_t i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        ret += ndiv2(a);
    }
    cout << ret << endl;
    return 0;
}

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

int main(){
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	string st;
	cin >> st;
	int c=0;
	for(int i=0;i<st.size()/2;i++)
		if(st[i]!=st[st.size()-i-1])
			c++;
	cout << c << endl;
}


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

int main(void) {

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

    vector<int> visit(n + 1);
    set<int> visited;

    visit[0] = 0;
    visited.insert(0);

    int now = 0;
    int cnt = 0;
    while (true) {
        now = a[now];
        cnt++;
        visit[cnt] = now;
        if (visited.count(now)) break;
        visited.insert(now);
    }

    // ループ前に終わっている場合
    if (k <= cnt) {
        cout << visit[k] + 1 << endl;
        return 0;
    }

    //ループの開始点のインデックスを取得
    int indexLoopStart = 0;
    for (int i = 0; i < cnt; i++) {
        if (visit[i] == visit[cnt]) {
            indexLoopStart = i;
            break;
        }
    }

    // 町1→ループ開始点までのテレポ回数を引いておく
    k -= indexLoopStart;

    // ループできる回数分だけ、kを引いていく。
    // 町visit[cnt]+1 → 町visit[cnt]+1 にループするのに、indexLoopStart → cntだけインデックスが増加しているので、テレポ回数は1ループ当たり(cnt - indexLoopStart)回
    int loopLength = cnt - indexLoopStart;
    k %= loopLength;

    cout << visit[indexLoopStart + k] + 1 << endl;

    return 0;

}


Measured memory_bytes: 13956
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, accumulate, inner_product
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string, stoi, to_string
#include <vector> // vector
#include <queue> // queue, priority_queue
#include <deque> // deque
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()

signed main() {
	std::string s;
	std::cin >> s;
	s[5] = ' ';
	s[8+5] = ' ';
	print(s);
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int x[10000] = {0};
  int i = 0;
  int j = 0;
  
  do {
   scanf("%d", &x[i]);
   i++;
  } while(x[i - 1]);

  j = i;

  for(i = 0; i < j - 1; i++)
    printf("Case %d: %d\n", i + 1, x[i]);
	
  return 0;
}

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

const long M = 1046527;
string H[M];

long getKey(string str){
    long sum = 0 , digit = 0 , p = 1;
    for (int i = 0; i < str.size() ; ++i) {
        if (str[i] == 'A') {
            digit = 1;
        } else if (str[i] == 'C') {
            digit = 2;
        } else if (str[i] == 'G') {
            digit = 3;
        } else if (str[i] == 'T') {
            digit = 4;
        } else digit = 0;
        sum += p * digit;
        p *= 5;
    }
    return sum;
}

long hash(long x) { return x % M ; }

long insert(string str){
    long x =getKey(str);
    for (int i = 0;  ; i++) {
            long h = (hash(x) +  i ) % M;
            if (H[h] == str) return 1;
            else if (H[h].size() == 0){
                H[h] = str;
                return 0;
            }
        }
    }

long find(string str){
    long x =getKey(str);
    for (int i = 0;  ; i++) {
        long h = (hash(x) +  i ) % M;
        if (H[h] == str) return 1;
        else if (H[h].empty()) return 0;
    }
}

int main(){
    string str,com;
    int n;
    cin >> n;
    for (int i = 0; i < n ; ++i) {
        cin >> com >> str;
        if(com == "insert"){
            insert (str);
        } else if (com == "find") {
            if(find (str)){
                cout << "yes" << endl;
            }else{
                cout << "no" << endl;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 25876
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d,e;
    cin >>a>>b>>c>>d>>e;
    
    if (a<40) a=40;      if(d<40) d=40;
    if (b<40) b=40;      if(e<40) e=40;
    if (c<40) c=40;
    cout << (a+b+c+d+e)/5 <<endl;
}



Measured memory_bytes: 3088
#include <stdio.h>
#include <stdlib.h>
main(){
  int i,j,k=0,l=0;
  char ch;
  char str1[200]="",str2[200],str3[200],str4[200];
  while(1){
    scanf("%s",str2);
    if(str2[0]=='-'&&str2[1]=='\0'){
      sprintf(str1,"%s%s\n",str1,str3);
      l=0;
      break;
    }
    if(atoi(str2)){
      if(l++==0)
        continue;
      for(i=atoi(str2);str3[i]!='\0';i++)
        str4[i-atoi(str2)]=str3[i];
      /* printf("%d\n",i-atoi(str2));       */
      j=i-atoi(str2);
      for(i=0;i<atoi(str2);i++)
        str4[j++]=str3[i];
      str4[j]='\0';
      sprintf(str3,"%s",str4);
    }
    else{
      if(k>0)
        sprintf(str1,"%s%s\n",str1,str3);
      sprintf(str3,"%s",str2);
      k++;
      l=0;
    }
    /* printf("%s\n",str3); */
  }
  printf("%s",str1);
return 0;
}

Measured memory_bytes: 572
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define inf 10000000000000000
#define mod 1000000007
typedef pair<int, int> P;

bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
	if (p == 0) return 1;
	if (p % 2 == 0) {
		int t = mod_pow(n, p / 2, m);
		return (t * t) % m;
	}
	return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}
int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

signed main() {
	int l, r;
	cin >> l >> r;
	int mi = 2020;
	for (int i = l; i < min(r, l + 2019 + 1); i++) {
		for (int j = i + 1; j < min(r+1, l + 2019 + 1); j++) {
			mi = min(mi, i * j % 2019);
		}
	}
	cout << mi << endl;

	return 0;
}


Measured memory_bytes: 256