akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(x) cout<<(x)<< endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(string, S);
  ll cnt = 0;
  each(x, S) {
    if (x == '0') cnt++;
  }
  print(min(cnt, (ll)S.length() - cnt) * 2);
}


Measured memory_bytes: 512
//go:generate echo "https://atcoder.jp/contests/dp/tasks/dp_c"
package main

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

type scanner struct{ *bufio.Scanner }

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	s.Buffer(nil, 100000000)
	return &scanner{s}
}

func (s *scanner) Int() int {
	s.Scan()
	n, _ := strconv.Atoi(s.Text())
	return n
}

func (s *scanner) IntSlice(l int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := range sl {
		sl[i] = s.Int()
	}
	return sl
}

func (s *scanner) IntSlice2(l, n int) []int {
	if l == 0 {
		return []int{}
	}
	sl := make([]int, l, l)
	for i := 0; i < n; i++ {
		sl[i] = s.Int()
	}
	return sl
}

func solve(n int, u [][]int) int {
	t := make([][]int, n+1, n+1)
	for i := range t {
		t[i] = make([]int, 3, 3)
	}
	for i := 0; i < n; i++ {
		for j := 0; j < 3; j++ {
			for k := 0; k < 3; k++ {
				if j == k {
					continue
				}
				if v := t[i][j] + u[i][k]; t[i+1][k] < v {
					t[i+1][k] = v
				}
			}
		}
	}
	max := math.MinInt64
	for _, v := range t[n] {
		if max < v {
			max = v
		}
	}
	return max
}

func main() {
	scan := newScanner(os.Stdin)
	n := scan.Int()
	u := make([][]int, n+1, n+1)
	for i := 0; i <= n; i++ {
		u[i] = []int{scan.Int(), scan.Int(), scan.Int()}
	}
	fmt.Println(solve(n, u))
}


Measured memory_bytes: 13304
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <iomanip>
#include <limits>
#include <utility>
#include <bitset>
#include <sstream>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
#define INF 1e18

int N, M, K;
int main()
{
	cin >> N >> K;
	vector<int> V(N + 1);
	rep(i, N) cin >> V[i];

	// A,B: 左端or右端から取り出す
	// C,D: 左端or右端に詰める

	// K 回行うとき，持っている宝石の価値の合計の最大値

	int ans = 0;
	for (int l = 0; l <= min(N,K); l++)
	{
		for (int r = 0; r <= min(N,K) - l; r++)
		{
			if (l + r > min(N,K))
				break;
			int d = K - l - r;
			int now = 0;
			vector<int> s;
			// とりだしていく
			for (int i = 0; i < l; i++)
			{
				now += V[i];
				s.push_back(V[i]);
			}
			for (int i = N - 1; i >= N - r; i--)
			{
				now += V[i];
				s.push_back(V[i]);
			}

			// sort:
			ans = max(ans, now);
			sort(s.begin(), s.end());
			for (int i = 0; i < d; i++)
			{
				if (i >= s.size())
					break;
				if (s[i] > 0)
					break;
				now -= s[i];
				ans = max(ans, now);
			}
		}
	}

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

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

int main() {
    long long n;

    cin >> n;
    vector<long long> v(n);

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

            cout << "0" << endl;
            return 0;
        }
    }
    sort(v.begin(), v.end());

    //long long ret = -1;
    long long iv = 1;
    for(int i = 0; i < n; i++) {
        //cout << to_string(iv).length() + to_string(v[i]).length() << endl;
        if (v[i]<=1000000000000000000/iv) {
            iv *= v[i];
        } else {
            cout << "-1" << endl;
            return 0;
        }
        //cout << iv << endl;
    }

    if(iv > 1000000000000000000) {
        iv = -1;
    }

    cout << iv << endl;
    return 0;
}

Measured memory_bytes: 4048
/*
RAHULKUMAR SINGH
*/
#include<iostream> 
#include<map>
#include<vector>
#include<cmath>
#include<cstring>
#include<climits>
#include<queue>
#include<algorithm>
#include<iomanip>
#define ll long long int
double PI =3.14159265;
using namespace std;


int main(){
 int n;
 cin>>n;
 int k=n%10;
 if(k==2 || k==4 || k==5 || k==7 || k==9){
 	cout<<"hon"<<endl;
 }
 else if(k==3){
 	cout<<"bon"<<endl;
 }
 else{
 	cout<<"pon"<<endl;
 }
}



Measured memory_bytes: 3604
import java.util.Scanner;
public class Main {
    
    static char[] k = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','w','z'};
    
    
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true) {
            String W = stdIn.next();
            if(W.equals("-")) {
                break;
            }
            int m = stdIn.nextInt();
            for(int i = 0; i < m; i++) {
                int h = stdIn.nextInt();
                String s1 = W.substring(0,h);
                String s2 = W.substring(h);
                W = s2 + s1;
            }
            System.out.println(W);
        }
    }
}


Measured memory_bytes: 26556
import java.util.*;
public class Main{
  public static int sumOfDigits(int n){
    int sum = 0;
    while(n>0){
      sum+=n%10;
      n/=10;
    }
    return sum;
  }
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int ans = Integer.MAX_VALUE;
    for(int i=1;i<N;i++){
      int sumA = sumOfDigits(i);
      int sumB = sumOfDigits(N-i);
      if(ans>sumA+sumB)ans = sumA+sumB;
    }
    System.out.println(ans);
  }
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int res,a,b = 0;
    string s;
    cin >> a >> b;
    for(int i=a;i<=b;i++){
        s = to_string(i);
        if(s[0]==s[4]&&s[1]==s[3]){
            res++;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define reps(i, n) for (int i = 1, i##_len = (int)(n); i <= i##_len; i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define repi(i, x) \
	for (auto i = (x).begin(), i##_fin = (x).end(); i != i##_fin; i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
string solve(bool a) { return ((a) ? "YES" : "NO"); }
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int, int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long, long long> P;
typedef vector<P> VP;
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;
}
template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
	os << "{";
	rep(i, v.size()) {
		if (i) os << ",";
		os << v[i];
	}
	os << "}";
	return os;
}
template <class T, class U>
istream& operator>>(istream& is, pair<T, U>& p) {
	is >> p.first >> p.second;
	return is;
}
template <class T>
istream& operator>>(istream& is, vector<T>& v) {
	rep(i, v.size()) { is >> v[i]; }
	return is;
}
const long long INFLL = 1LL << 60;
const int INF         = 1 << 30;
const double PI       = acos(-1);
int main() {
	int n, m;
	int ans = 0;
	cin >> n;
	V d(n);
	cin >> d >> m;
	V t(m);
	cin >> t;
	sort(all(d));
	sort(all(t));
	auto ter1 = d.begin();
	auto ter2      = t.begin();
	while(ter1!=d.end() and ter2!=t.end()){
		if(*ter1==*ter2){
			ter1++;
			ter2++;
		}else
		{
			ter1++;
		}
		
	}
	cout << solve(ter2==t.end()) << endl;
}

Measured memory_bytes: 6320
//file_name:ABC92_B.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    int n,d,x;
    scanf("%d%d%d",&n,&d,&x);
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }


    ll ans = 0;
    ans += x;
    rep(i,n){
        int dd = d;
        ans++;
        dd--;
        while(dd>0){
            dd -= a[i];
            if(dd>=0){
                ans++;
            }
        }
    }

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



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdlib>

int main(void){
    char n[128];

    while(std::cin >> n){
        //std::cout << n << std::endl;
        int n2 = std::atoi(n);
        std::cout << (n2 * n2 * n2) << std::endl;
    }

    return(0);
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> state;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
char changeS(char alpha){
  if(0x41 <= alpha and alpha <= 0x5A)return (alpha + 0x20);
  else if(0x61 <= alpha and alpha <= 0x7A)return (alpha - 0x20);
  return alpha;
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }
int ceil(int a,int b){
  // a/bの切り上げを考える
  return (a+b-1)/b;
}


int popcount(int n){
  int cnt = 0;
  while(n > 0){
    if (n == 1){
      cnt++;
      break;
    }
    if (n % 2 == 1)cnt++;
    n /= 2;
  }
  return cnt;
}

int f(int n, int cnt){
  if(n == 0)return cnt;
  n = n % popcount(n);
  cnt++;
  return f(n, cnt);
}

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

  // 可変配列の初期化．初期値は0
  vector<int> X(n);
  vector<int> ans(n);

  // 文字列で入力した2進数をint型で再格納
  rep(i,n) X[i] = x[i] - '0'; 

  // 与えられた2進数でビットが立っている桁数を求める(popcount(n))
  int pc = 0;
  rep(i,n) pc += X[i];

  // popcount(n+1),popcount(n-1)について処理を行う．
  rep(b,2){
    int pcnt = pc;
    if (b == 0)pcnt++; else pcnt--;
    if(pcnt <= 0)continue;

    // n % popcountを行う
    int r = 0;
    rep(i,n){
     r = (r * 2) % pcnt;
     r += X[i];
    }

    int k = 1;
    for (int i = n-1; i >= 0; i--){
      // 1bitごとにずらした分だけn % popcount(n)の処理を行う
      if (X[i] == b){
        int tempr = r;
        if (b == 0)tempr = (tempr + k) % pcnt;
        else tempr = (tempr - k + pcnt) % pcnt;
        ans[i] = f(tempr, 0) + 1;
      }
      k = (k*2) % pcnt;
    }
  }
  rep(i,n)cout << ans[i] << endl;
}


Measured memory_bytes: 5248
#include<iostream>

using namespace std;

int main(){
    int N;
    cin >> N;
    int upper = 50000;
    int lower = -1;

    bool ok = false;
    int ans;
    while(upper - lower > 1){
        int middle = (upper + lower) / 2;
        if(int(middle * 1.08) == N){
            ok = true;
            ans = middle;
        }
        if(int(middle * 1.08) > N){
            upper = middle;
        }
        else{
            lower = middle;
        }
    }
    if(ok) cout << ans << endl;
    else cout << ":(" << endl;
    return 0;
}

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

using LL = long long;

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

  int ans;
  vector<int> vec(3);
  int K;
  for (int i = 0; i < 3; i++) {
    cin >> vec[i];
  }
  cin >> K;

  decltype(vec)::iterator itr = max_element(vec.begin(), vec.end());
  int maxIndex = distance(vec.begin(), itr);

  for (int i = 0; i < K; i++) {
    vec[maxIndex] *= 2;
  }

  ans = accumulate(vec.begin(), vec.end(), 0);

  cout << ans << '\n';

  return 0;
}

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

using namespace std;
#define DBG(x)                         \
    (void)(cout << "L" << __LINE__     \
                << ": " << #x << " = " \
                << (x) << '\n')
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
typedef long long ll;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;
const int INF = 0x3f3f3f3f;
const int maxn = 1100000;

void run_case()
{
    ll x;
    cin >> x;
    vector<int> p;
    while (x)
    {
        int cur = x % 26;
        if (cur == 0)
        {
            p.push_back(26);

            x = x / 26 - 1;
        }
        else
        {
            p.push_back(cur);
            x /= 26;
        }
    }
    for (int i = p.size() - 1; i >= 0; i--)
    {
        cout << char(p[i] + 'a' - 1);
    }
    cout << "\n";
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setiosflags(ios::fixed) << setprecision(12);
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 3656
/*#include<iostream>
using namespace std;
int main(){
  int A[3];
  for(int i=1;i<=3;i++){
    cin>>A[i];
    }
  cout<<A[2]<<endl;
  return 0;
  }*/
#include<iostream>
using namespace std;
int main(){
  int a,b,c,e;
  int d=0;
  cin>>a>>b>>c;
  for(int i=a;i<=b;i++){
    e=c%i;
    if(e==0){
      d+=1;
    }
  }
  cout<<d<<endl;
  return 0;
}

Measured memory_bytes: 1164
#include <stdio.h> 
 
int main() {
  int x,i,n;
 
  scanf("%d",&n);
   
  for(i=1; i<=n; i++) {
    x = i;
     
    if(x %3 == 0) {
      printf(" %d",i);
    } else if(x % 10 == 3) {
      printf(" %d",i);
    } else { 
      while(x != 0) {
    x /=10;
    if(x % 10 == 3) {
      printf(" %d",i);
      break;
    }
      }
    }
     
  }
  printf("\n");
  return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <cstdio>
#include <cassert>
#include <vector>
using namespace std;

char first;

int ask(int x)
{
	fflush(stdout);
	printf("%d\n", x);
	fflush(stdout);
	string S;
	cin >> S;
	if(S[0] == 'V') exit(0);
	fflush(stdout);
	return (S[0] != first);
}

int main(void)
{
	int n;
	scanf("%d", &n);
	
	fflush(stdout);
	printf("0\n");
	fflush(stdout);
	string S;
	cin >> S;
	if(S[0] == 'V') exit(0);
	fflush(stdout);
	first = S[0];
	//cout << first << "\n";
	
	int L = 0, R = n-1;
	while(L <= R)
	{
		int mid = (L+R)/2, p, e[2];
		p = ask(mid), e[0] = mid%2, e[1] = (n+1-mid)%2;
		if(p == e[0]) L = mid+1;
		else R = mid-1;
	}
	assert(false);
}

Measured memory_bytes: 852
macro_rules! bind_from_vec {
    ( $($variable:ident),+ = $vector: expr ) => {
        let mut v = $vector.clone().into_iter();
        $(let $variable = v.next().unwrap();)+
    };
}

macro_rules! read_line {
    () => {{
        let mut input = String::new();
        std::io::stdin().read_line(&mut input).unwrap();
        input
    }};
}

fn read_to_vec<T: std::str::FromStr>() -> Vec<T> {
    read_line!().split_whitespace()
        .map(|e| e.parse::<T>().ok().unwrap())
        .collect()
}

fn main() {
    bind_from_vec!(w, h, x, y = read_to_vec::<i64>());

    println!("{} {}", (w * h) as f64 / 2.0, if x * 2 == w && y * 2 == h {1} else {0});
}

Measured memory_bytes: 4352
import sys
input = sys.stdin.readline

n,k= map(int, input().split())

if k>(n-1)*(n-2)//2:
    print(-1)

else:
    ans=[]
    # 1と他の点を繋ぐ
    for i in range(n-1):
        ans.append([1,i+2])

    v=(n-1)*(n-2)//2-k

    for i in range(2,n):
        for j in range(i+1,n+1):
            if v>0:
                ans.append([i,j])
                v-=1
            else:
                break

    print(len(ans))
    for i in range(len(ans)):
        print(*ans[i])

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


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

    int x, y;
    string ret = "Yes";
    cin >> x >> y;
    int k = y-2*x, t = 4*x-y;
    if(k<0 || t<0) ret = "No";
    if(k%2 != 0 || t%2 != 0) ret = "No";
    //int k = y - 2*x;
    //if(k<0) ret = "No";
    //else if(k%2 != 0) ret = "No";
    //else if(x - k < 0) ret = "No";
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define all(a) (a).begin(), (a).end()
typedef long long ll;
#define INF 1e9
typedef pair<int, int> P;

/* 　"assert"    assert(A：条件式)で　Aが真なら処理は続行、偽ならプログラムを終了する　*/

/*　　ラムダ式　　 auto a = [キャプチャ](パラメータ){ 処理 }  */

/* string型　メンバ関数　substr()    replace()  */

int main(){
    int n, r; cin >> n >> r;
    if (n >= 10) {
        cout << r << endl;
        return 0;
    }else{
        cout << r + 100*(10-n) << endl;
        return 0;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

int main(){
  ll N, K, Q;
  cin >> N >> K >> Q;
  ll sc[N];
  fill(sc, sc + N, 0);

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

  for(int i = 0; i < N; i++){
    sc[i] += K;
    sc[i] -= Q;
  }

  for(int i = 0; i < N; i++){
    if(sc[i] > 0){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 1408
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl(1);
const ll mod = 1000000007;
//const ll mod = 998244353;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

bool check(ll n,vector<ll> G[]){
  ll S=0;
  for(auto&&i:G[1])S+=i;
  // cout<<S<<endl;
  //check
  for (int i = 1; i <= n; i++)
  {
    ll num=0;
    for(auto&&j:G[i])num+=j;
    if(num!=S){
      return false;
    }
  }
  return true;
}

void solve(ll n){
  vector<ll> G[n+1];

  ll sum;
  if(n%2==0)sum=n+1;
  if(n%2==1)sum=n;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(i==j)continue;
      if(i+j!=sum)G[i].push_back(j);
    }
  }
  vector<pair<ll,ll>>ans;
  for(int i=1;i<=n;i++){
    for(auto&&j:G[i]){
      if(j<=i)continue;
      ans.push_back(make_pair(i,j));
    }
  }

  cout<<ans.size()<<endl;
  for(auto&&i:ans)cout<<i.first<<" "<<i.second<<endl;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);cout<<fixed;
  cout<<setprecision(30);
  ll n;cin>>n;
  solve(n);
  //for(int i=3;i<=100;i++)solve(i);
}


Measured memory_bytes: 640
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<numeric>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b));i>=((int)(a));i--)
typedef long long ll;
typedef pair<ll, ll> mp;
ll MOD = 1e9+7;
//LLONG_MIN

//AC

int main(void){
	ll n,a,pos[200010],ans=0;
	set<ll> v;
	scanf("%lld",&n);
	v.insert(0);
	v.insert(n+1);
	for(ll i=1;i<=n;i++){
		scanf("%lld",&a);
		pos[a]=i;
	}
	for(ll i=1;i<=n;i++){//上から順にとっていく
		auto itr = v.lower_bound(pos[i]);
		ll r = (*itr) - pos[i];
		itr--;
		ll l = pos[i] - (*itr);
		ans+=r*l*i;
		itr++;
		v.insert(itr,pos[i]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define SIZE 10
#define PI 3.141592653589793

using namespace std;
typedef long long ll;

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

	int N,M;
	int i,j;
	int tmp;
	int answer=0;
	int counter=0;
	vector<int> given;

	cin >> N >> M;

	for(i=0;i<M;i++){
		cin >> tmp;
		given.push_back(tmp);
	}

	answer=N;
	for(i=0;i<M;i++){
		answer-=given[i];
	}

	if(answer<0){
		cout << "-1" << endl;
		return 0;
	}

	cout << answer << endl;

	return 0;
}



Measured memory_bytes: 3704
import Data.IORef
import Control.Monad
 
main :: IO()
main = getLine >> getContents >>= solve.map read.lines >>= print
 
solve :: [Int] -> IO Int
solve (x:y:xs) = do
                  a <- newIORef (y - x)
                  b <- newIORef (min x y)
                  forM_ xs $ \z -> do
                    a' <- readIORef a
                    b' <- readIORef b
                    when (z - b' > a') $ writeIORef a (z - b')
                    when (z < b')      $ writeIORef b z
                  readIORef a

Measured memory_bytes: 5532
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
struct edge{int to,idx;};
vector<edge>G[50];
int pre[50];
void dfs(int s,int p){
    for(int i=0;i<G[s].size();i++){
        if(p!=G[s][i].to){
            pre[G[s][i].to]=pre[s]^1ll<<G[s][i].idx;
            dfs(G[s][i].to,s);
        }
    }
}
signed main(){
    int n,a,b,m,u,v,egs[20];
    cin>>n;
    for(int i=0;i<n-1;i++){
        cin>>a>>b;
        a--,b--;
        G[a].push_back(edge{b,i});
        G[b].push_back(edge{a,i});
    }
    cin>>m;
    for(int i=0;i<m;i++){
        cin>>u>>v;
        u--,v--;
        pre[u]=(1ll<<n-1)-1;
        dfs(u,-1);
        egs[i]=pre[v];
    }
    int ans=0;
    for(int s=1;s<1ll<<m;s++){
        int tmp=(1ll<<n-1)-1;
        for(int i=0;i<m;i++)
            if(s&1ll<<i)
                tmp&=egs[i];
        int c=__builtin_popcountll(tmp);
        if(__builtin_parityll(s))
            ans+=1ll<<c;
        else
            ans-=1ll<<c;
    }
    cout<<(1ll<<n-1)-ans<<endl;
}


Measured memory_bytes: 384
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long S = sc.nextLong();

        long X1=0, Y1=0, X2,Y2,X3,Y3;
        // S = abs(X2 * Y3 - X3 * Y2)
        X2 = 1000000000;
        Y3 = (S+X2-1) / X2;

        X3 = 1;
        Y2 = (X2*Y3-S)/X3;
        System.out.printf("%d %d %d %d %d %d\n", X1, Y1, X2, Y2, X3, Y3);
    }
}

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2

int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/

const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;


int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    //cout << "Fi Amanillah" << endl;

    int n;
    cin >> n;

    vector < int >v(n);
    f0(i,n) cin >> v[i];

    sort(all(v));

    float ans =v[0];

    f1(i,n-1){
        ans+=v[i];
        ans/=2.0;
    }

    cout << ans << endl;


    return 0;
}




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

int main(){

  string s, t;
  cin >> s;
  cin >> t;

  int sl = s.size();
  int tl = t.size();

  vector<int> v;

  for (int i = 0; i < sl; i++){
    for (int j = 0; j < tl; j++){
      if (i + j >= sl) break;
      if (s[i+j] != '?') if (s[i+j] != t[j]) break;
      if (j == tl - 1) {
        v.push_back(i);
      }
    }
  }

  if (v.empty()){
    printf("UNRESTORABLE\n");
    return 0;
  }

  int u = v[v.size()-1];
  for (int i = 0; i < u; i++){
    if (s[i] == '?') s[i] = 'a';
    printf("%c", s[i]);
  }
  cout << t;
  for (int i = u + tl; i < sl; i++){
    if (s[i] == '?') s[i] = 'a';
    printf("%c", s[i]);
  }
  printf("\n");

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
#define ALL(x) (x).begin(),(x).end()
const ll zero = 0;
const ll one = 1;
const ll INF = 9223372036854775807; //10^18
const int inINF = 2147483647; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

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

    vector<int> C(N+1, 0), CA(N+1, 0), CB(N+1, 0);
    for (int i = 0; i < N; i++) {
        CA[A[i]]++;
        CB[B[i]]++;
    }
    for (int i = 0; i < N+1; i++) {
        C[i] = CA[i] + CB[i];
    }
    vector<iint> D;
    for (int i = 0; i < N+1; i++) {
        if(C[i] > 0){
            D.push_back(make_pair(C[i], i));
        }
    }

    sort(ALL(D), greater<iint> ());
    if(D[0].first >= N+1){
        No();
        return 0;
    }

    Yes();
    int l = D.size();
    vector<int> AA;
    for (int i = 0; i < l; i++) {
        for (int j = 0; j < CA[D[i].second]; j++) {
            AA.push_back(D[i].second);
        }
    }

    vector<int> BB(N, 0);
    int ind = CA[D[0].second];
    for (int i = 0; i < l; i++) {
        for (int j = 0; j < CB[D[i].second]; j++) {
            while(AA[ind] == D[i].second || BB[ind] != 0){
                ind++;
                if(ind == N) ind = 0;
            }
            BB[ind] = D[i].second;
        }
    }

    vector<iint> AB(N);
    for (int i = 0; i < N; i++) {
        AB[i].first = AA[i];
        AB[i].second = BB[i];
    }
    sort(ALL(AB));
    for (int i = 0; i < N; i++) {
        printf("%d ", AB[i].second);
    }

    cout << endl;


}

Measured memory_bytes: 11976
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
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 (b<a) {a=b; return 1;} return 0;}

const string YES = "Yes";
const string NO = "No";

bool ok(string s) {
    int n = s.size();
    bool res = true;
    rep(i, n) {
        if (i > n-1-i) break;
        if (s[i] != s[n-1-i]) res = false;
    }
    return res;
}

int main(){
    string s;
    cin >> s;
    int n = s.size();
    if (ok(s) && ok(s.substr(0, n/2)) && ok(s.substr((n+1)/2, n/2))) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
ll gcd(ll a, ll b){
    ll r = a % b;
    while(r){
        a = b, b = r;
        r = a % b;
    }
    return b;
}
int main() {
    init();
    ll a, b;
    cin >> a >> b;
    cout << gcd(a, b) << endl;
}


Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
#include <stdio.h>
#include <cfenv>
#include <cmath>
using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main() {
    ll x,tmp;
    cin >> x;
    tmp = x/11*2;
    x %= 11;
    if(x > 0){
        tmp++;
        x -= 6;
    }
    if(x > 0) tmp++;

    cout << tmp << endl;
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;


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

  int n, c, k;
  cin >> n >> c >> k;
  vector<int> s;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    s.push_back(x);
  }
  sort(s.begin(), s.end());
  int C = c;
  int ans = 0;
  long long time = 0;
  for (int i = 0; i < n; ++i) {
    int cur = s[i];
    if (C == c || k + time < cur) {
      C = 0;
      ++ans;
      time = cur;
    }
    ++C;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include <map>
#include <vector>
#include <cstring>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <deque>
#define mp make_pair
using namespace std;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	a=a*100+b*10+c;
	if (a%4==0) cout<<"YES"; else cout<<"NO";
	return 0; 
} 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const long long mod=998244353;
long long C[5005][5005];
int n,k;
long long calc(int n, int k)
{
    if (n<0 || k<0 || k>n) return 0;
    return C[n][k];
}
int main()
{
	scanf("%d%d",&k,&n);
	for (int i=0;i<=5001;i++)
	{
		C[i][0]=C[i][i]=1;
		for (int j=1;j<i;j++)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
	}
	for (int x=2;x<=k+k;x++)
	{
		//k-(x-(k+1))+1
		int i=(x>k+1)?k+k-x+2:x,u=min(k,i/2),v=max(1,i-k);
		long long ans=0;
		for (int j=0;j<=u-v+1;j++)
			ans=(ans+calc(u-v+1,j)*calc(n+k-j-j-1,n-j-j)*((j%2==0)?1:-1)%mod)%mod;
		printf("%lld\n",(ans+mod)%mod);
	}
	return 0;
}

Measured memory_bytes: 194048
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>

#define rep(i, n) for(int i = 0; i < n; i ++)
#define ALL(T) T.begin(), T.end()
#define mp make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> pii;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;

int main(void){
    int cnt = 0;
    for(string in; cin >> in;){
        string rin = in;
        reverse(ALL(rin));
        if(in == rin) cnt ++;
    }
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1192
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
        int a,b,c;
        cin >> a;
        cin >> b;
        cin >> c;
        if(a<b&&b<c){
            cout << "Yes";
        }
        else {
            cout << "No";
        }
        
        cout << endl;
         
     
}



Measured memory_bytes: 3108
H, W = map(int, input().split())
S = [list(input().split()) for _ in range(H)]

alp ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"

for ite, line in enumerate(S):
  for itr, val in enumerate(line):
    if val == "snuke":
      print(alp[itr]+str(ite+1))
      exit()

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

int main() {
    lint n, a, b;
    cin >> n >> a >> b;

    lint c = n / (a + b);
    lint res = a * c;
    n %= a + b;
    res += min(n, a);

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<queue>
#include<cstdlib>
#include<cmath>
#include<map>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)
#define reep(i,n) reps(i,1,n+1)

#define INF 1000000000

class T{
	public:
	int y,x,num;
	T(int y,int x,int num):y(y),x(x),num(num){}
	T(pair<int,int> yx,int num):y(yx.first),x(yx.second),num(num){}
};

int w,h;
string masu[20];
int cnum[20][20];
int graph[20][20];

bool cvisit(int visit, int num){
	if(visit&(1<<num))return true;
	return false;
}

bool allvisit(int n, int visit){
	reps(i,1,n)if(cvisit(visit,i)==false)return false;
	return true;
}

int memo[(1<<15)];

int saiki(int n, int now, int visit){
	
	int key = visit + (now<<10);
	
	if(visit==1){
		return 0;
	}
	
	if(memo[key]!=-1) return memo[key];
	
	int ans = INF;
	reps(i,1,n){
		if(cvisit(visit,i)==true){
			int nextvisit = visit - (1<<i);
			ans = min(ans, graph[now][i] + saiki(n, i, nextvisit));
		}
	}
	
	/*
	printf("%d %d ",n,now);
	rep(i,n)printf("%d",cvisit(visit, i));
	printf("  = %d\n",ans);*/
	return memo[key]=ans;
}

int main(){
	
	while(1){
		cin>>w>>h;
		if(w==0)break;
		vector<pair<int,int> > st(1);
		rep(i,20)rep(j,20)cnum[i][j]=-1;
		rep(i,(1<<15))memo[i]=-1;
		
		int n = 1;
		rep(i,h){
			cin>>masu[i];
			rep(j,w){
				if(masu[i][j]=='*'){
					cnum[i][j] = n++;
					st.push_back(make_pair(i,j));
				}
				if(masu[i][j]=='o'){
					cnum[i][j] = 0;
					st[0] = make_pair(i,j);
				}
			}
		}
		
		rep(i,20)rep(j,20)graph[i][j]=INF;
		
		rep(i,n){
			queue<T> que;
			que.push(T(st[i],0));
			
			int visit[20][20]={0};
			while(1){
				if(que.empty())break;
				
				T u = que.front();
				que.pop();
				
				int y = u.y;
				int x = u.x;
				
				if(x<0 || y<0 || x>=w || y>=h)continue;
				if(masu[y][x]=='x')continue;
				if(visit[y][x]==1)continue;
				visit[y][x]=1;
				
				if(cnum[y][x]!=-1 && cnum[y][x]!=i){
					graph[i][cnum[y][x]]=u.num;
				}
				
				int dy[] = {1,0,-1,0};
				int dx[] = {0,1,0,-1};
				
				rep(p,4){
					que.push(T(y+dy[p], x+dx[p], u.num+1));
				}
			}
		}
		
		/*
		rep(i,n){
			rep(j,n){
				printf("%d ",graph[i][j]);
			}puts("");
		}*/
		
		int ans = saiki(n, 0 ,(1<<n)-1);
		if(ans == INF) puts("-1");
		else printf("%d\n",ans);
	}
}

Measured memory_bytes: 1368
#include <bits/stdc++.h>
#define int long long
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/

int n, a[114514];
set<int>st;
signed main() {
	cin >> n;
	rep(i, n) {
		cin >> a[i];
		st.insert(a[i]);
	}
	if (st.size() % 2)cout << st.size() << endl;
	else cout << st.size() - 1 << endl;
}

Measured memory_bytes: 5760
using System;
class Scores_1632{
  public static void Main(){
    String[] str;
    str = Console.ReadLine().Split(' ');
    int n=int.Parse(str[0]);
    int m=int.Parse(str[1]);
    while(n!=0 && m!=0){
      int[,] score = new int[n,m];
      int[] sum = new int[n];
      int max=0;
      for(int i=0; i<m; i++){
        str = Console.ReadLine().Split(' ');
        for(int j=0; j<n; j++){
          score[j,i] = int.Parse(str[j]);
        }
      }

      for(int i=0; i<n; i++){
        sum[i] = 0;
      }
      for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){
          sum[i]+=score[i,j];
        }
      }
      for(int i=0; i<n; i++){
        if(max <= sum[i]){
          max = sum[i];
        }
      }
      Console.WriteLine(max);
      str = Console.ReadLine().Split(' ');
      n=int.Parse(str[0]);
      m=int.Parse(str[1]);
    }
  }
}



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

using namespace std;
#define _rep(n, a, b) for (ll n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (ll n = (a); n >= (b); --n)
#define _for(n, a, b) for (ll n = (a); n < (b); ++n)
#define _rof(n, a, b) for (ll n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f
#define ll long long
#define db long double
#define eps 1e-3
#define bin(x) cout << bitset<10>(x) << endl;
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<ll, ll>
#define pdd pair<db, db>
#define endl "\n"
const ll mod = 1e9 + 7;
const ll maxn = 2e5 + 10;
deque<ll> a;
db posd[maxn], negd[maxn];

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    ll all = 0;
    _rep(i, 1, n) {
        all += (i + 1) * i / 2;
    }

    _rep(i, 1, n - 1) {
        ll u, v;
        cin >> u >> v;
        if (u > v)swap(u, v);
        all -= u * (n - v + 1LL);
    }
    cout << all << endl;
}

Measured memory_bytes: 3612
import sys 
input = sys.stdin.readline
from collections import deque
def solve():
  n = int(input())
  d = [[]*n for _ in range(n)]
  for i in range(n-1):
    a,b,c = (int(i) for i in input().split())
    d[a-1].append((b-1,c))
    d[b-1].append((a-1,c))
  q,k = (int(i) for i in input().split())
  #kからの距離を計算する
  d2 = [10**10]*n
  visit = [False]*n
  query = deque([(k-1,0)]) #始点、距離
  while query:
    place,dist = query.pop()
    if visit[place]:
      continue
    else:
      visit[place] = visit
      d2[place] = dist
      for i in range(len(d[place])):
        np,nc = d[place][i]
        if not visit[np]:
          query.append((np,nc+dist))
  for i in range(q):
    x,y = (int(i) for i in input().split())
    print(int(d2[x-1] + d2[y-1]))

solve()

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

if (R - L) >= 2019:
    print (0)
else:
    min_p = 2019
    for n in range(L, R):
        for n2 in range(n + 1, R + 1):
            tmp_p = (n * n2) % 2019
            if (tmp_p < min_p):
                min_p = tmp_p

    print (min_p)


Measured memory_bytes: 2940
import java.util.*; 
import java.lang.*; 
import java.io.*; 

class Main 
{ 
	 
	class Edge implements Comparable<Edge> 
	{ 
		int src, dest, weight; 
 
		public int compareTo(Edge compareEdge) 
		{ 
			return this.weight-compareEdge.weight; 
		} 
	}; 

	
	class subset 
	{ 
		int parent, rank; 
	}; 

	int V, E; 
	Edge edge[]; 

	
	Main(int v, int e) 
	{ 
		V = v; 
		E = e; 
		edge = new Edge[E]; 
		for (int i=0; i<e; ++i) 
			edge[i] = new Edge(); 
	} 

	
	int find(subset subsets[], int i) 
	{ 
		
		if (subsets[i].parent != i) 
			subsets[i].parent = find(subsets, subsets[i].parent); 

		return subsets[i].parent; 
	} 

	
	void Union(subset subsets[], int x, int y) 
	{ 
		int xroot = find(subsets, x); 
		int yroot = find(subsets, y); 

		
		if (subsets[xroot].rank < subsets[yroot].rank) 
			subsets[xroot].parent = yroot; 
		else if (subsets[xroot].rank > subsets[yroot].rank) 
			subsets[yroot].parent = xroot; 

		
		else
		{ 
			subsets[yroot].parent = xroot; 
			subsets[xroot].rank++; 
		} 
	} 

	
	void KruskalMST() 
	{ 
		Edge result[] = new Edge[V]; 
		int e = 0; 
		int i = 0;  
		for (i=0; i<V; ++i) 
			result[i] = new Edge(); 
 
		Arrays.sort(edge); 

		
		subset subsets[] = new subset[V]; 
		for(i=0; i<V; ++i) 
			subsets[i]=new subset(); 

		
		for (int v = 0; v < V; ++v) 
		{ 
			subsets[v].parent = v; 
			subsets[v].rank = 0; 
		} 

		i = 0;  

		
		while (e < V - 1) 
		{ 
			
			Edge next_edge = new Edge(); 
			next_edge = edge[i++]; 

			int x = find(subsets, next_edge.src); 
			int y = find(subsets, next_edge.dest); 

			 
			if (x != y) 
			{ 
				result[e++] = next_edge; 
				Union(subsets, x, y); 
			} 
			
		} 

		
		int sum=0;
		for(int i1=0;i1<e; ++i1) {
			sum += result[i1].weight;
		}
		System.out.println(sum);
	} 

	
	public static void main (String[] args) 
	{ 

		
		
		
		Scanner sc = new Scanner(System.in);
		String str;
		str = sc.nextLine();
		String[] s = str.split(" ");
		int V = Integer.parseInt(s[0]);
		int E = Integer.parseInt(s[1]);
		Main graph = new Main(V,E);
		
		
		for(int i=0; i < E;i++) {
			str = sc.nextLine();
			String[] S =  str.split(" ");
			int src = Integer.parseInt(S[0]);
			int dest = Integer.parseInt(S[1]);
			int weight = Integer.parseInt(S[2]);
			graph.edge[i].src = src;
			graph.edge[i].dest = dest;
			graph.edge[i].weight = weight;
		}
		graph.KruskalMST();
	} 
} 





Measured memory_bytes: 160252
import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val n     = input.nextLine().toInt
      val words = 1.to(n).map(_ => input.nextLine())

      val isDuplicate = words.sorted.distinct.size != words.size
      val isConnected = words.sliding(2).forall {
        case Seq(first, second) => first.last == second.head
      }

      if (!isDuplicate && isConnected)
        output.println("Yes")
      else
        output.println("No")
    }

  }

}


Measured memory_bytes: 27432
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7

# ここから書き始める
x = int(input())
ans = (x // 500) * 1000
x %= 500
ans += (x // 5) * 5
print(ans)


Measured memory_bytes: 5568
def solution():
    a, b, c = [x for x in input().strip().split(" ")]
    if (a == b and b == c) or (a != b and a !=c and b != c):
        print("No")
    else:
        print("Yes")

def main():    
    # T = int(input().strip())
    for _ in range(1):
        solution()
    

main()

Measured memory_bytes: 38256