akhauriyash/Code-Regression huggingface dataset:
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}
func absint(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var n int

	fmt.Sscan(getNextLine(scanner), &n)
	xxx := make([]int, n)
	yyy := make([]int, n)

	prev := 0
	current := 0
	max := 0

	for i := 0; i < n; i++ {
		fmt.Sscan(getNextLine(scanner), &xxx[i], &yyy[i])

		abs := absint(xxx[i]) + absint(yyy[i])
		if abs > max {
			max = abs
		}
		current = ((xxx[i]+yyy[i])%2 + 2) % 2
		if i > 0 && prev != current {
			fmt.Println(-1)
			return
		}
		prev = current
	}

	d := 1
	for d < max {
		d <<= 1
	}
	ddd := make([]int, 0)
	if current == 0 {
		ddd = append(ddd, 1)
	}
	for i := 1; i < d; i <<= 1 {
		ddd = append(ddd, i)
	}
	dString := ""
	for i := len(ddd) - 1; i >= 0; i-- {
		dString += fmt.Sprintf("%d", ddd[i])
		if i > 0 {
			dString += " "
		}
	}
	fmt.Println(len(ddd))
	fmt.Println(dString)
	for i := 0; i < n; i++ {
		directions := ""
		for di := len(ddd) - 1; di >= 0; di-- {
			if absint(xxx[i]) > absint(yyy[i]) {
				if xxx[i] > 0 {
					xxx[i] -= ddd[di]
					directions += "R"
					continue
				}
				xxx[i] += ddd[di]
				directions += "L"
				continue
			}
			if yyy[i] > 0 {
				yyy[i] -= ddd[di]
				directions += "U"
				continue
			}
			directions += "D"
			yyy[i] += ddd[di]
		}
		if xxx[i] > 0 {
			directions += "R"
		}
		if xxx[i] < 0 {
			directions += "L"
		}
		if yyy[i] > 0 {
			directions += "U"
		}
		if yyy[i] < 0 {
			directions += "D"
		}
		fmt.Println(directions)
	}
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a.begin(),a.end());
  int sum=0;
  for(int i=0;i<k;i++){
    sum += a[n-1-i];
  }
  cout<<sum<<endl;
}


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

int main(){
  int64_t N, ans = (1LL << 62);
  cin >> N;
  vector<int64_t> A(N), S(N + 1, 0);
  for (int i = 0; i < N; i++)
  {
    cin >> A.at(i);
    S.at(i + 1) = A.at(i) + S.at(i);
  }
  for (int k = 3; k <= N - 1; k++) // 1-indexedでDが開始するindex
  {
    auto a = lower_bound(S.begin(), S.begin() + k, S.at(k - 1) / 2);
    int64_t ic = distance(S.begin(), a); // 前半の和の半分以上となる1-indexedのindex
    int64_t s1 = S.at(k - 1);
    int64_t ma1, ma2, maa, mia;
    ma1 = max(S.at(ic), s1 - S.at(ic));
    ma2 = max(S.at(ic - 1), s1 - S.at(ic - 1));
    maa = min(ma1, ma2);
    mia = s1 - maa;

    auto b = lower_bound(S.begin() + k + 1, S.end(), (S.at(N) - S.at(k - 1)) / 2 + S.at(k - 1));
    int64_t ie = distance(S.begin(), b); // 後半の和の半分以上となる1-indexedのindex
    int64_t s2 = S.at(N) - S.at(k - 1);
    int64_t mb1, mb2, mab, mib;
    mb1 = max(S.at(ie) - S.at(k - 1), s2 - (S.at(ie) - S.at(k - 1)));
    mb2 = max(S.at(ie - 1) - S.at(k - 1), s2 - (S.at(ie - 1) - S.at(k - 1)));
    mab = min(mb1, mb2);
    mib = s2 - mab;
    ans = min(ans, max(maa, mab) - min(mia, mib));
  }
  cout << ans << endl;
}

Measured memory_bytes: 6352
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#define SIZE 2005
#define MOD 1000000007

using namespace std;
typedef long long int ll;

ll dp[SIZE][SIZE];
int L;

void make()
{
	ll r1=1;
	for(int i=0;i<L-2;i++) r1=r1*2LL%MOD;
	for(int i=1;i<=L;i++) dp[L][i]=r1;
	for(int i=L+1;i<SIZE;i++)
	{
		ll sum=0;
		for(int j=i;j>=1;j--)
		{
			dp[i][j]=dp[i-1][max(1,j-1)];
			if(j<=i-2)
			{
				sum+=dp[i-1][j];
				if(sum>=MOD) sum-=MOD;
				dp[i][j]+=sum;
				if(dp[i][j]>=MOD) dp[i][j]-=MOD;
			}
		}
		//if(i<=5) {for(int j=1;j<=i;j++) printf("%d ",dp[i][j]);puts("");}
	}
}
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	L=n-k+1;
	make();
	printf("%lld\n",dp[n][1]);
	return 0;
}


Measured memory_bytes: 22784
#include "bits/stdc++.h"
using namespace std;

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	string s;
	cin >> s;
	int sum = 0;
	for (int i = 0; i < 4; i++) {
		if (s[i] == '+') {
			sum++;
		}
		else {
			sum--;
		}
	}
	cout << sum;
}

Measured memory_bytes: 256
// D - Coloring Edges on Tree
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
#define eb emplace_back
#define NMAX 100000

int K = 1;
vvi tree(NMAX);
vi colors(NMAX), visited(NMAX);

void dfs(int p, int p_color){
	K = max(K, (int)tree[p].size());
	int color = 1;
	for(int c:tree[p]){
		if(visited[c]) continue;
		visited[c] = true;
		colors[c] = color==p_color? ++color: color;
		dfs(c, color++);
	}
}

int main(){
	int N; cin>>N;
	vi C(N-1);
	rp(i, 0, N-1){
		int p,c; cin>>p>>c; p--,c--;
		tree[p].eb(c); tree[c].eb(p);
		C[i] = c;
	}
	visited[0] = true;
	dfs(0, -1);
	cout<< K <<endl;
	for(auto c:C) cout<< colors[c] <<endl;
}

Measured memory_bytes: 8320
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define ll long long
#define imfor(i, n) for(int i = 0; i < n; i++)
using namespace std;
ll MOD = 1000000007;

int main() {
    int n;
    int a;
    cin >> n;
    cin >> a;
    if (n % 500 <= a) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

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


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

char field[1010][1010];

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

    int h, w;
    cin >> h >> w;
    queue< pair<int, int> > q;
    rep (i, h)
    {
        rep (j, w)
        {
            cin >> field[i][j];
            if (field[i][j] == '#') q.push(pair<int, int>{i, j});
        }
    }

    int ans = -1;
    int dy[] = {-1, 0, 1, 0};
    int dx[] = {0, -1, 0, 1};
    while (!q.empty())
    {
        ++ans;
        int s = q.size();
        rep (j, s)
        {
            pair<int, int> p = q.front(); q.pop();
            int y = p.first;
            int x = p.second;
            rep (i, 4)
            {
                int ny = y + dy[i];
                int nx = x + dx[i];
                if (IN(0, h, ny) && IN(0, w, nx) && field[ny][nx] != '#')
                {
                    q.push(pair<int, int>{ny, nx});
                    field[ny][nx] = '#';
                }
            }
        }
    }

    cout << ans << "\n";
    return 0;
}



Measured memory_bytes: 9488
# C - Not so Diverse
# coding: utf-8

import collections

N, K = map(int, raw_input().split())
A = map(int, raw_input().split())
A_dict = collections.Counter(A)
A_common = A_dict.most_common(K)

if len(A_dict) <= K:
  result = 0
else:
  result = N
  for i in range(K): result -= A_common[i][1]

print result

Measured memory_bytes: 28820
import java.util.Scanner;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
	    int a = sc.nextInt();
	    int b = sc.nextInt();
	    

	    if ( a < b ) {
			System.out.println("a < b");

	    } else if (a > b ) {
			System.out.println("a > b");
			
		} else {
			System.out.println("a == b");
			

		}

	}

}

Measured memory_bytes: 17316
N = int(input())
box = list(map(int, input().split()))

if N%2==1:
    check = [1] + [2]*N
else:
    check = [2] + [2]*N
    
for i in box:
    check[i] -= 1

cnt = 0

for i in box:
    if check[i] == 0:
        cnt += 1
    else:
        print(0)
        break

if cnt == len(box):
    print(2**(N//2)%(10**9+7))

Measured memory_bytes: 13880
#include <iostream>
#include <string>

using namespace std;

bool even(string s)	{
  string x = s.substr(0, s.length() / 2);
  int j = 0;
  for (int i = s.length() / 2; i < s.length(); i++)	{
    if (x[j] != s[i])	{
      return false;
    }
    j++;
  }
  return true;
}

int main()	{
  string s;
  cin >> s;
  s.pop_back();
  s.pop_back();
  while (!even(s))	{
    s.pop_back();
    s.pop_back();
  }
  cout << s.length() << endl;
  return 0;
}

Measured memory_bytes: 3560
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

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

  int n, a, b;
  cin >> n >> a >> b;

  if((b - a) % 2 == 0){
    cout << "Alice" << endl;
  }
  else{
    cout << "Borys" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
import collections
import math

n=int(input())
a=list(map(int,input().split()))
ev=[a[2*i] for i in range(n//2)]
od=[a[2*i+1] for i in range(n//2)]

ccev=collections.Counter(ev)
ccod=collections.Counter(od)

mcev=ccev.most_common()
mcod=ccod.most_common()

if mcev[0][0]!=mcod[0][0]:
    print(n-mcev[0][1]-mcod[0][1])
    exit()
elif len(mcev)==1 and len(mcod)==1:
    print(n-mcev[0][1])
    exit()
elif len(mcev)==1:
    print(n-mcod[1][1])
    exit()
elif len(mcod)==1:
    print(n-mcev[1][1])
    exit()
else:
    tt=max(mcev[1][1],mcod[1][1])
    print(n-mcev[0][1]-tt)
    exit()


Measured memory_bytes: 28012
S = input()
cnt = 0
if S[0] == 'R' and S[1] == 'R' and S[2] == 'R':
    cnt = 3
else:
    if S.count('R') == 2:
        for i in range(2):
            if S[i] == 'R' and S[i+1] == 'R':
                cnt = 2
                break
            elif S[i] != S[i+1] and S[i+1] != S[i+2]:
                cnt = 1
                break
    if S.count('R') == 1:
        cnt = 1
print(cnt)

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

#define a first
#define b second

const int M_MAX = 1e5;

int n, m, a, b;
pair<int, int> query[M_MAX + 2];

int ans;

int main()
{
    cin >> n >> m;
    for(int i = 1; i <= m; i++)
        cin >> query[i].a >> query[i].b;

    sort(query + 1, query + m + 1);

    int dr = query[1].b;
    for(int i = 2; i <= m; i++)
    {
        if(query[i].a >= dr)
        {
            ans++;
            dr = query[i].b;
        }
        else
            dr = min(dr, query[i].b);
    }

    cout << ans + 1 << '\n';

    return 0;
}


Measured memory_bytes: 1024
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}}
void readA(T)(size_t n,ref T t){t=new T(n);auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(ElementType!T);r.popFront;}}
void readM(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=readln.splitter;foreach(ref v;t){v[i]=r.front.to!(ElementType!(typeof(v)));r.popFront;}}}
void readS(T)(size_t n,ref T t){t=new T(n);foreach(ref v;t){auto r=readln.splitter;foreach(ref j;v.tupleof){j=r.front.to!(typeof(j));r.popFront;}}}

void main()
{
  int a, b; readV(a, b);

  auto c = new bool[][](100, 100);
  foreach (i; 50..100) c[i][] = true;

  foreach (i; 0..a-1) {
    auto y = i/50*2, x = i%50*2;
    c[y][x] = true;
  }

  foreach (i; 0..b-1) {
    auto y = i/50*2+51, x = i%50*2;
    c[y][x] = false;
  }

  writeln("100 100");
  foreach (i; 0..100) {
    foreach (j; 0..100)
      write(c[i][j] ? "." : "#");
    writeln;
  }
}


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

struct node {
	int key;
	node *parent, *left, *right;
	node(int x)
	{
		key = x;
		parent = left = right = NULL;
	}
};

struct Tree {
	node *root;
	Tree() {
		root = NULL;
	}
} T;

void insert(int k) {
	node *z = new node(k);
	node *y = NULL;
	node *x = T.root;
	while (x != NULL) {
		y = x;
		if (x->key > z->key) {
			x = x->left;
		} else {
			x = x->right;
		}
	}
	if (y != NULL) {
		z->parent = y;
		if (z->key > y ->key) {
			y->right = z;
		} else {
			y->left = z;
		}
	} else {
		T.root = z;
	}
}

void inorder(node *v) {
	if (v == NULL) 
		return;
	inorder(v->left);
	cout << " " << v->key;
	inorder(v->right);
}

void preorder(node *v) {
	if (v == NULL)
		return;
	cout << " " << v->key;
	preorder(v->left);
	preorder(v->right);
}

int main(void) 
{
	int n, x;
	string com;
	cin >> n;
	while (n--) {
		cin >> com;
		if (com[0] == 'i') {
			cin >> x;
			insert(x);
		} else {
			inorder(T.root);
			cout << endl;
			preorder(T.root);
			cout << endl;
		}
	}
}


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

int main()
{
 ll a,b,c,d;
 cin>>a>>b>>c>>d;
 ll z=a*c;
 ll x=a*d;
 ll y=b*c;
 ll t=b*d;
 ll ans1=max(x,y);
 ll ans2=max(t,z);
 ll ans=max(ans1,ans2);
 cout<<ans;
 return 0;
}


Measured memory_bytes: 3620
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define pi acos(-1.0)
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }
ll jou(ll N, ll P){if(P==0) return 1;
    if(P%2==0){ll t = jou(N, P/2);return t*t % mod;
    }return (N * jou(N, P-1)) % mod;}  //jou(n,mod-2)で逆元
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//  cout << fixed << setprecision (20);   小数点以下2０桁まで
//実行時間制約2秒では２×10^8回くらいまで計算できる


struct UF {
    vector <ll> par; // 各元の親を表す配列
    vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

    UF(ll sz_): par(sz_), siz(sz_, 1LL) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1LL);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};


int main() {
  int n,k,l;
  cin >>n>>k>>l;
  
  UF road(n);
  UF rail(n);
  
  rep(i,k){
  ll x,y;
  cin>>x>>y;
  road.unite(x-1,y-1);
  }
  
  rep(i,l){
  ll x,y;
  cin>>x>>y;
  rail.unite(x-1,y-1);
  }

  map<pair<int,int>,int> p;
  rep(i,n){
  auto w=mp(road.root(i),rail.root(i));
    if(p.count(w)) p.at(w)++;
    else p[w]=1;
  }
   
  rep(i,n){
  auto w=mp(road.root(i),rail.root(i));    
  cout << p.at(w) << endl;
  }
  
}

Measured memory_bytes: 19840
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b=map(int,input().split())
tmp=n//(a+b)
ans=tmp*a
if n-tmp*(a+b)>=a:
    ans+=a
else:
    ans+=n-tmp*(a+b)
print(ans)

Measured memory_bytes: 65388
import java.util.*;

class Main{

    public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int t;
	int[] max = new int[2]; 
	int[] a = new int[102];

	while(true){
	int n = sc.nextInt();
	int q = sc.nextInt();

	if( (n|q) == 0 ) break;
	

	Arrays.fill(a,0);
	max[0] = 0;

	for(int l=0; l<n ;l++){
	    int m = sc.nextInt();
	    for(int k=0; k<m ; k++){
		t=sc.nextInt();
		a[t]++;
		if(max[0] < a[t]){
			max[0]=a[t];
			max[1]=t;
		}else if(max[0]==a[t]){
		    if(max[1]>t){
			max[0]=a[t];
			max[1]=t;
		    }
		}
	    }
	
	}
	if(max[0]>=q) System.out.println( max[1] );
	else System.out.println( "0" );
    }
}   
}

Measured memory_bytes: 12000
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
const vector<string> status = {"AC", "WA", "TLE", "RE"};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  map<string, int> ct;
  int n;
  cin >> n;
  string s;
  while (n--) {
    cin >> s;
    ct[s]++;
  }
  for (auto ss : status) {
    cout << ss << " x " << ct[ss] << "\n";
  }
}

Measured memory_bytes: 3664
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
    char str[1001];
    while(1) {
        int sum = 0;
        scanf("%s", str);
        if (str[0] == '0') break;
        for (int i = 0;i < strlen(str);i++){
            sum += (str[i] - '0');
        }
        printf("%d\n", sum);
    }
    return 0;
}


Measured memory_bytes: 2748
/**
*    author:  yuya1234
*    created: 27.06.2020 16:00:22
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)

#define ALL(x) x.begin(),x.end()
#define SORT(x) sort(x.begin(),x.end())
#define SORTD(x) sort(x.rbegin(),x.rend())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define SZ(x) ll(x.size())

#define MEMSET(v, h) memset((v), h, sizeof(v))

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

  int a,b;
  cin>>a>>b;

  int cnt=1,ans=0;

  while (b>cnt)
  {
    cnt+=a-1;
    ans++;
  }

  cout<<ans<<endl;

  return 0;
}

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

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

    int n[3];
    cin >> n[0] >> n[1] >> n[2];

    sort(n, n + 3);
    cout << n[2] * 10 + n[1] + n[0] << endl;

    return 0;
}


Measured memory_bytes: 256
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::collections::VecDeque;
use std::cmp::{max, min};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        tas: [(i64, i64); n],
    }
    let mut l: i64 = 1;
    let mut r : i64 =  1;
    //println!("");
    for ta in tas {
        let k = max((ta.0 + l - 1)/ta.0, (ta.1 + r - 1)/ta.1);
        l = ta.0 * k;
        r = ta.1 * k;
    }
    println!("{}", l + r);
}

Measured memory_bytes: 4352
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int m, n;
    cin >> m >> n;
    vector<pair<int, int>> students;
    vector<pair<int, int>> points;
    for (int i = 0; i < m; ++i) {
        pair<int, int> p;
        cin >> p.first >> p.second;
        students.push_back(p);
    }
    for (int i = 0; i < n; ++i) {
        pair<int, int> p;
        cin >> p.first >> p.second;
        points.push_back(p);
    }
    for (auto student : students) {
        int ans;
        int min_dist;
        if (n > 1) {
            ans = 0;
            min_dist = abs(student.first - points[0].first) + abs(student.second - points[0].second);
        }
        for (int i = 1; i < n; ++i) {
            int dist = abs(student.first - points[i].first) + abs(student.second - points[i].second);
            if (dist < min_dist) {
                min_dist = dist;
                ans = i;
            }
        }
        cout << ans + 1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

using Graph = vector<vector<pair<ll,ll> > >;

int main() {
    // 頂点数と辺数
    int N; cin >> N;

    // グラフ入力受取 (ここでは無向グラフを想定)
    Graph G(N);
    for (int i = 0; i < N-1; ++i) {
        int a, b, c;
        cin >> a >> b >> c;
        a--;b--;
        G[a].push_back(mp(b,c));
        G[b].push_back(mp(a,c));
    }

    // BFS のためのデータ構造
    vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
    queue<int> que;

    // 初期条件 (頂点 0 を初期ノードとする)
    dist[0] = 0;
    que.push(0); // 0 を橙色頂点にする

    // BFS 開始 (キューが空になるまで探索を行う)
    while (!que.empty()) {
        int v = que.front(); // キューから先頭頂点を取り出す
        que.pop();

        // v から辿れる頂点をすべて調べる
        for(int i=0;i<G[v].size();i++){
            int nv = G[v][i].first;
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない

            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = (dist[v] + G[v][i].second)%2;
            // cout<<v<<" "<<nv<<" "<<dist[nv]<<endl;
            que.push(nv);
        }
    }

    // 結果出力 (各頂点の頂点 0 からの距離を見る)
    rep(i,N) cout<<dist[i]<<endl;
}


Measured memory_bytes: 8320
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

public class Main {

		public static void main(String[] args){
			int iro = 0 ;
			int sum = 0;
			int kasan = 0 ;
			 
			Scanner sc = new Scanner(System.in);
			// 整数の入力
			// スペース区切りの整数の入力
			int a = sc.nextInt();

			ArrayList<Integer> stateList = new ArrayList<Integer>();
					
			for (int i = 0; i < a;i ++ ){
				stateList.add(sc.nextInt());
			}
			 
			int stArray[] = new int[8];
			for(int i=0;i<stateList.size();i++){
				if ((stateList.get(i) >= 1 ) & (stateList.get(i) <= 399)) {
					stArray[0] = 1;
				}else if((stateList.get(i) >= 400 ) & (stateList.get(i) <= 799) ){
					stArray[1] = 1;
				}else if((stateList.get(i) >= 800 ) & (stateList.get(i) <= 1199) ){
					stArray[2] = 1;
				}else if((stateList.get(i) >= 1200 ) & (stateList.get(i) <= 1599) ){
					stArray[3] = 1;
				}else if((stateList.get(i) >= 1600 ) & (stateList.get(i) <= 1999) ){
					stArray[4] = 1;
				}else if((stateList.get(i) >= 2000 ) & (stateList.get(i) <= 2399) ){
					stArray[5] = 1;
				}else if((stateList.get(i) >= 2400 ) & (stateList.get(i) <= 2799) ){
					stArray[6] = 1;
				}else if((stateList.get(i) >= 2800 ) & (stateList.get(i) <= 3199)) {
					stArray[7] = 1;
				}else{
					kasan = kasan + 1;
				}
    		 }

    		 for(int j=0;j<8;j++){
    			 if (stArray[j] == 1){
    				 sum = sum + 1;
    			 }
	    	 }
    		 kasan = kasan + sum;
    		 if (sum == 0){
    			 sum = 1;
    		 }
    		 // 出力
			System.out.println(sum + " " +  kasan );
		}
}


Measured memory_bytes: 21204
#include <iostream>
#include <vector>

#ifndef EOF
#define EOF (-1)
#endif

int main() {
    std::vector<int> digits;
    int a, b;
    while (scanf("%d %d", &a, &b) != EOF)
    {
        int sum = a + b;
        int t = sum / 10;
        int digit = 1;
        while (t > 0) {
            digit++;
            t = t / 10;
        }
        digits.push_back(digit);
    }

    for (int i = 0; i < digits.size(); i++) {
        std::cout << digits[i] << std::endl;
    }

    return 0;
}

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

int main() {
  		int N, A;
  		cin>> N;
        if(1<=N && N<=9){
          A=N;
        }else if(10<=N && N<=99){
          A=9; 
        }else if(100<=N && N<=999){
          A=9 + N-99; 
        }else if(1000<=N && N<=9999){
          A=909; 
        }else if(10000<=N && N<=99999){
          A=909 + N - 9999; 
        }else{
          A= 90909; 
        }
        cout<< A <<endl;  
            }

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#define rep(i,m,n) for(int i=m; i<(n); i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
typedef long long ll;
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll a, b;
    a = x/500;
    x -= a*500;
    b = x/5;
    cout << 1000*a + 5*b;
}


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

int main() {
	int X[7], Y;
	string S;
	for (int i = 1; i <= 6; i++) {
		cin >> X[i];
	}
	cin >> S;
	for (int i = 0; i < S.size(); i++) {
		Y = X[1];
		if (S[i] == 'N') {
			X[1] = X[2], X[2] = X[6], X[6] = X[5], X[5] = Y;
		}
		if (S[i] == 'S') {
			X[1] = X[5], X[5] = X[6], X[6] = X[2], X[2] = Y;
		}
		if (S[i] == 'W') {
			X[1] = X[3], X[3] = X[6], X[6] = X[4], X[4] = Y;
		}
		if (S[i] == 'E') {
			X[1] = X[4], X[4] = X[6], X[6] = X[3], X[3] = Y;
		}
	}
	cout << X[1] << endl;
}


Measured memory_bytes: 3208
import math


aLength, bLength, hour, minite = map(int, input().split())


aRadian = 2 * math.pi * (hour + minite/60) / 12
bRadian = 2 * math.pi * minite / 60


aPosX, aPosY = (aLength*math.cos(aRadian), aLength*math.sin(aRadian))
bPosX, bPosY = (bLength*math.cos(bRadian), bLength*math.sin(bRadian))


print(math.sqrt((aPosX-bPosX)**2 + (aPosY-bPosY)**2))


Measured memory_bytes: 9572
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s1,s2,s3;
  cin >>s1>>s2>>s3;
  s1[0]=s1[0]-32;
  s2[0]=s2[0]-32;
  s3[0]=s3[0]-32;
  cout << s1[0]<<s2[0]<<s3[0]<< endl;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

if sum(A) < sum(B):
    print(-1)
else:
    before = [A[i] - B[i] for i in range(N)]
    before.sort()
    diff = [A[i] - B[i] for i in range(N)]
    # print(diff)
    diff.sort()
    left = 0
    right = N - 1
    while True:
        if diff[left] < 0:
            temp = diff[left]
            diff[left] = min(0, diff[left] + diff[right])
            diff[right] -= diff[left] - temp
        if diff[left] == 0:
            if diff[left + 1] < 0:
                left += 1
        if diff[right] == 0:
            if diff[left] < 0:
                right -= 1
        if diff[left] == 0:
            break
    # print(diff)
    cnt = 0
    for i in range(N):
        if before[i] != diff[i]:
            cnt += 1
    print(cnt)

Measured memory_bytes: 85424
def main():
	n, m = map(int, input().split())
	a = list(map(int, input().split()))
	dic = {}
	lst = []
	for i in a:
		if i in dic:
			dic[i] = dic[i] + 1
		else:
			lst += [i]
			dic[i] = 1
	for _ in range(m):
		b, c = map(int, input().split())
		if c in dic:
			dic[c] = dic[c] + b
		else:
			dic[c] = b
			lst += [c]
	lst.sort()
	lst = lst[::-1]
	i = 0
	ans = 0
	while n>0:
		ans += lst[i]*min(dic[lst[i]], n)
		n -= dic[lst[i]]
		i += 1
	print(ans)
	return
main()

Measured memory_bytes: 32064
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#define MAX_N 100005
#define pii pair<int,int>
#define ll long long
#define FREI freopen("in.txt","r",stdin)
#define FREO freopen("out.txt","w",stdout)
using namespace std;
int n, m, src;
vector<pair<int, int> >g[MAX_N];
ll dis[MAX_N];
bool vis[MAX_N];
void dfs(int u)
{
    for(int i=0;i<g[u].size();i++)
    {
        int v=g[u][i].first;
        if(vis[v]==0)
        {
            vis[v]=1;
            dis[v]=min(dis[v],dis[u]+g[u][i].second);
            dfs(v);
        }
    }
}
int main()
{
    //FREI;
    //std::ios::sync_with_stdio(false);
    cin>>n;
    int u,v,cost;
    for(int i=0;i<n-1;i++)
    {
        cin>>u>>v>>cost;
        g[u].push_back(pii(v,cost));
        g[v].push_back(pii(u,cost));
    }
    for (int i = 0; i <= n; i++) dis[i] = 9223372036854775807;
	memset(vis, 0, sizeof(vis));
    int q,k;
    cin>>q>>k;
    src=k;
    vis[k]=1;
    dis[k]=0;
    dfs(k);
    for(int i=0;i<q;i++)
   {
       cin>>u>>v;
       cout<<dis[u]+dis[v]<<endl;
   }
    return 0;
}


Measured memory_bytes: 14592
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		sc.close();
		
		String ans;
		ans = a.equals(b) ? "H" : "D";
	
		System.out.println(ans);

	}

}

Measured memory_bytes: 21460
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n;
	cin >> n;
	int pre = 0;
	i64 ans = 0, cur = 0;
	REP(i, n)
	{
		int a;
		cin >> a;
		
		if (i == 0)
		{
			pre = a;
			continue;
		}

		if (pre >= a)
		{
			pre = a;
			cur++;
		}
		else
		{
			if (ans < cur)
				ans = cur;
			pre = a;
			cur = 0;
		}
	}
	if (ans < cur)
		ans = cur;

	print(ans);
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

int main()
{
    double N;
    scanf("%lf", &N);
    for(double i = N; i>=(double)1; i--){
        int sq = sqrt(i);
        if(sq*sq == i){
            printf("%d", (int)i);
            exit(0);}
    }
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]C - City Savers
            int n = int.Parse(Console.ReadLine());
            var a = ReadLine(); //モンスターの数
            var b = ReadLine(); //勇者が倒せるモンスター

            long monsters = 0; //倒したモンスター
            long remaind = 0;

            for(int i = 0; i < n; i++)
            {
                long enemy = a[i] - remaind;

                if (enemy < 0)
                {
                    enemy = 0;
                }
                
                if (b[i] > enemy)
                {
                    monsters += a[i];
                }
                else
                {
                    monsters += remaind + b[i];
                }

                if (b[i] > enemy)
                {
                    remaind = b[i] - enemy;
                }
                else
                {
                    remaind = 0;
                }
            }

            if (remaind > a[n])
            {
                monsters += a[n];
            }
            else
            {
                monsters += remaind;
            }

            Console.WriteLine(monsters);
        }

        static List<long> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => long.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 33116
#include<stdio.h>
int main()
{
   long long N,M,i,s=0;
    scanf("%lld %lld",&N,&M);
    long long A[M];
    for(i=0;i<M;i++)
    {
        scanf("%lld",&A[i]);
        s=s+A[i];
    }
    if(N-s>=0)
    printf("%lld\n",N-s);
    else
    printf("-1");
    return 0;
    
} 

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

ans = 0
x, y = map(int, input().split())
Max_A = x+y
Min_A = x+y
Max_B = -x+y
Min_B = -x+y

for i in range(1,N):
  x, y = map(int, input().split())
  C = x + y
  D = -x + y
  temp = max( abs(Max_A-C), abs(Min_A-C), abs(Max_B-D), abs(Min_B-D) )
  ans = max(ans, temp)
  #print(C, D, ans)
  Max_A = max(Max_A, C)
  Max_B = max(Max_B, D)
  Min_A = min(Min_A, C)
  Min_B = min(Min_B, D)

print(ans)

Measured memory_bytes: 9236
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A.at(i);
    ll res = 0;
    rep(i,N) {
        if (A.at(i) % 2 == 1) continue;
        while (A.at(i) % 2 == 0) {
            A.at(i) /= 2;
            res++;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 384
b = list(input())
for i in range(0, len(b)):
    if b[i] == 'A':
        b[i] = 'T'
    elif b[i] == 'T':
        b[i] = 'A'
    elif b[i] == 'G':
        b[i] = 'C'
    else:
        b[i] = 'G'
print("".join(b))

Measured memory_bytes: 3060
#define _USE_NATH_DEFINES
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <string>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
using namespace std;

int main() {
	int n;
	double t, a;
	double h[1000];
	double tmp = 1000;
	int ans;
	cin >> n >> t >> a;
	rep(i, n) {
		cin >> h[i];
		double tmp_a = t - h[i] * 0.006;
		if (abs(tmp_a-a) < tmp) {
		tmp = abs(tmp_a-a);
		ans = i+1;
	    }
	}
	cout << ans << endl;
	return 0;
}

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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) ll aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) string aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007


int main() {
	
	int N;
	cin>>N;
	vec(A)
	map<int,int> K;
	fx(N){
		vecp(A)
		K[A.at(x)]++;
	}
	int sum=0;
	fx(N){
      if(K[A.at(x)]>0){
		sum+=K[A.at(x)]-1;
		K[A.at(x)]=0;
      }
    }

	N-=sum;
	N-=(sum%2)*2-(sum%2);
    
	ce(N)
}

Measured memory_bytes: 5368
// بسم الله الرحمان الرحیم //
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N = 2e5 + 100;
#define pb push_back;
#define faster ios::sync_with_stdio(false), cin.tie(0);

int main()
{
    faster
    int n; cin >> n;
    int alan = n / 1000;
    if (alan * 1000 != n)
        alan ++;
    cout << (alan * 1000) - n;
}





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

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

    int A[9] = {};
    for(int i = 0; i < n; i++){
        int tmp;
        cin >> tmp;
        if(tmp <= 399) A[0]++;
        else if(400 <= tmp and tmp <= 799) A[1]++;
        else if(800 <= tmp and tmp <= 1199) A[2]++;
        else if(1200 <= tmp and tmp <= 1599) A[3]++;
        else if(1600 <= tmp and tmp <= 1999) A[4]++;
        else if(2000 <= tmp and tmp <= 2399) A[5]++;
        else if(2400 <= tmp and tmp <= 2799) A[6]++;
        else if(2800 <= tmp and tmp <= 3199) A[7]++;
        else A[8]++;
    }
    int cnt = 0, min_value, max_value;
    for(int i = 0; i < 8; i++){
        if(A[i]) cnt++;
    }
    if(A[8]){
        if(cnt){
            min_value = cnt;
            max_value = cnt + A[8];
        }else{ 
          min_value = 1;
          max_value = A[8];
        }
    }else min_value = max_value = cnt;
    cout << min_value << " "  << max_value << endl;

    return 0;
}


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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007
#define MAX 510000

#define	Rep0(i, n)	for (auto i=0; i<n; i++)
#define	Rep1(i, n)	for (auto i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

ll	MPl(ll x, ll y) {
	return ((x+y)%MOD+MOD)%MOD;
}

ll	MMi(ll x, ll y) {
	return ((x-y)%MOD+MOD)%MOD;
}

ll	MMul(ll x, ll y) {
	return ((x*y)%MOD+MOD)%MOD;
}

// Array
vector<ll> fac(MAX, 0);
vector<ll> finv(MAX, 0);
vector<ll> inv(MAX, 0);

void	DivInit() { // fac, finv, inv
	fac.at(0) = 1;
	fac.at(1) = 1;
	finv.at(0) = 1;
	finv.at(1) = 1;
	inv.at(1) = 1;
	for (int i=2; i<MAX; i++) {
		fac.at(i) = (fac.at(i-1)*i) %MOD;
		inv.at(i) = MOD - (inv.at(MOD%i)*(MOD/i)) %MOD;
		finv.at(i) = (finv.at(i-1)*inv.at(i)) %MOD; 
	}
}

ll	MDiv(ll x, ll y) {
	if (1!=inv.at(1))
		DivInit();
	if (y<0) {
		x=-x;
		y=-y;
	}
	return ((x*inv.at(y))%MOD+MOD)%MOD;
}

ll	MComb(ll N, ll K) {
	if (1!=inv.at(1))
		DivInit();
	if (N<K)
		return 0;
	if ((N<0)||(K<0))
		return 0;
	return (fac.at(N) * ((finv.at(K)*finv.at(N-K)) %MOD)) %MOD;
}

int	main() {
	int N;
	cin >>N;
	vector<ll> A(N, 0);
	Rep0(i, N)
		cin >>A.at(i);
	ll ANS=0;
	ll ANS2=0;
	ll ANS3=0;
	for (auto AA: A) {
		ANS2 =MPl(ANS2, AA);
		ANS3 =MPl(ANS3, MMul(AA, AA));
	}
	ANS=MMul(ANS2, ANS2);
	ANS=MMi(ANS, ANS3);
	ANS=MDiv(ANS, 2);
	cout <<ANS <<endl;
	return 0;
}



Measured memory_bytes: 16720
#include <stdio.h>

int main(void)
{
	char in, val[100] = {};
	register char i, max = 0;
	while (scanf("%d", &in) != EOF)
		val[in - 1]++;
	for (i = 0; i < 100; i++)
		if (max < val[i])
			max = val[i];
	for (i = 0; i < 100; i++)
		if (max == val[i])
			printf("%d\n", i + 1);
	return 0;
}

Measured memory_bytes: 596
n = int(input())
s = [input() for _ in range(n)]
d = {}
for w in s:
    if w not in d:
        d[w] = 0
    d[w] += 1
d2 = sorted(d.items(), key=lambda x:x[1], reverse=True)
maxcnts = [w[0] for w in d2 if w[1] == d2[0][1]]
maxcnts.sort()
for ans in maxcnts:
    print(ans)

Measured memory_bytes: 47348
//#include<bits/stdc++.h>
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<utility>
#include<algorithm>
#include<cstring>
#include<sstream>
#include <iomanip>

using namespace std;

typedef long long ll ;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector< pair<int,int> > vii;
const double pi = 2*acos(0) ;

#define pf		  	printf
#define sf			  scanf
#define pb(a)         push_back(a)
#define mp			make_pair
#define fi			 first
#define se			 second
#define for0(i,n)        for(int i=0;i<n;i++)
#define for1(i,n)        for(int i=1;i<=n;i++)
#define forab(i,a,b)       for(int i=a;i<=b;i++)
#define lcm(a, b)     ((a)*((b)/gcd(a,b)))
#define sq(a)		   (a)*(a)
#define nw				"\n"
#define abs(x)		fabs(x)
#define pcase(z,x)    cout<<"Case "<<z<<": "<<x<<"\n"

int main()
{
	int n,i,c=0,x,y;
	cin>>n;
	vi a(n);
	for0(i,n) cin>>a[i];
	for(i=1 ; i<n-1 ; i++){
		x = max(a[i],max(a[i+1],a[i-1]));
		y = min(a[i],min(a[i+1],  a[i-1]));
		if(a[i]>y && a[i]<x) c++;
		}
	cout<<c<<nw;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <int> :: iterator sitr;
typedef set <ll> :: iterator sltr;
#define mset multiset
typedef mset <int> msi;
typedef mset <ll> msll;
typedef mset <int> :: iterator msitr;
typedef mset <ll> :: iterator msltr;
#define mp make_pair
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 126)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 126)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 126)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
//void IO(){
//	#ifndef ONLINE_JUDGE
//	    freopen("input.txt", "r", stdin);
//	    freopen("output.txt", "w", stdout);
//	#endif
//}
// end of Template

int pd[200000],sum[200000],n,m,f;
int main(){
	//IO();
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin>>n>>m;
    for(int i=1;i<=m;i++){
        int l,r;
        cin>>l>>r;
        pd[l]++;
        pd[r+1]--;
    }

    for(int i=1;i<=n;i++){
        sum[i]=sum[i-1]+pd[i];
    }
    for(int i=1;i<=n;i++){
        if(sum[i]==m){f++;}
    }
    cout<<f<<newl;

}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int lli;
lli mod=1000000007;
#define Jaldi_jaldi_kar_subha_panvel_ke_liye_nikalna_hai ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
lli power(lli x,lli y,lli m)   
{ 
    lli res = 1; 
    x=x%m;   
    while (y > 0) 
    {  
        if (y%2==1) 
            res =(res*x)%m;  
        y=y/2; 
        x=(x*x)%m; 
    } 
    return res; 
}
int main()
{
    Jaldi_jaldi_kar_subha_panvel_ke_liye_nikalna_hai
    lli n,a,b;
    cin>>n>>a>>b;
    lli ans=power(2,n,mod);
    lli anum=1,bnum=1;
    lli adenom=1,bdenom=1;
    for(lli start=n-a+1;start<=n;++start)
    	anum=(anum*start)%mod;
    for(lli start=n-b+1;start<=n;++start)
    	bnum=(bnum*start)%mod;
    for(lli start=1;start<=a;++start)
    	adenom=(adenom*start)%mod;
    for(lli start=1;start<=b;++start)
    	bdenom=(bdenom*start)%mod;
    ans=(ans-(anum*power(adenom,mod-2,mod))%mod+mod)%mod;
    ans=(ans-(bnum*power(bdenom,mod-2,mod))%mod+mod)%mod;
    cout<<(ans-1+mod)%mod<<endl;
}

Measured memory_bytes: 256