akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict


def read_input():
    n, k = map(int, input().split())

    tups = []
    for i in range(n):
        tups.append(list(map(int, input().split())))

    return n, k, tups

def submit():
    n, k, tups = read_input()

    occurs = defaultdict(int)

    for tup in tups:
        occurs[tup[0]] += tup[1]

    nums = list(occurs.items())
    nums.sort(key=lambda x : x[0])

    count = 0
    for num in nums:
        if k <= count + num[1]:
            print(num[0])
            return
        count += num[1]



if __name__ == '__main__':
    submit()

Measured memory_bytes: 69976
#include<stdio.h>
#include<math.h>
int main()
{
	int n,x;
	double x1,x2,x3,y1,y2,y3,xp,yp;
	double a1,b1,c1,a2,b2,c2,r;
	scanf("%d",&n);
	for(x=0; x<n; x++)
	{
		scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
		a1=2*(x2-x1);
		b1=2*(y2-y1);
		c1=x1*x1-x2*x2+y1*y1-y2*y2;
		a2=2*(x3-x1);
		b2=2*(y3-y1);
		c2=x1*x1-x3*x3+y1*y1-y3*y3;
		xp=(b1*c2-b2*c1)/(a1*b2-a2*b1);
		yp=(c1*a2-c2*a1)/(a1*b2-a2*b1);
		r=((xp-x2)*(xp-x2)+(yp-y2)*(yp-y2));
		r=sqrt(r);
		printf("%.3f %.3f %.3f\n",xp,yp,r);
	}
	return 0;
}

Measured memory_bytes: 656
#include <cstdio>
int main() {
    int N;

    while(scanf("%d", &N), N) {
        int sum = 0, A[10010];
        for(int i=0; i<N; i++) {
            scanf("%d", &A[i]);
            sum += A[i];
        }

        int ans = 0;
        for(int i=0; i<N; i++) {
            ans += (N * A[i] <= sum);
        }
        printf("%d\n", ans);
    }
    return 0;
}


Measured memory_bytes: 2732
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a[9],n,sum=0;
    while(cin>>n){
        if(n==0)break;
        for(int i=0;i<9;i++){
            cin>>a[i];
            sum+=a[i];
        }
        cout<<n-sum<<endl;
        sum=0;
    }
    return 0;
}

Measured memory_bytes: 3004
#include <stdio.h>


long abso(long x){
  if(x>=0){
    return x;
  }else{
    return -x;
  }
}

long main(void){
  long N;
  int K;
  scanf("%ld%d",&N,&K);

  long point[N];
  long dp[N];

  for(long i = 0;i<N;i++){
    scanf("%ld",&point[i]);
    dp[i] = 0;
  }
  for(long i = 1;i<N;i++){
    for(int j = 1;j<=K;j++){
      if(i-j>=0){
        long sample = dp[i-j]+abso(point[i]-point[i-j]);
        if(j == 1){
          dp[i] = sample;
        }else if(dp[i]>sample){
          dp[i] = sample;
        }
      }
    }
  }

  printf("%ld\n",dp[N-1]);

  return 0;
}

Measured memory_bytes: 1664
def main():
    N, M = (int(i) for i in input().split())

    def prime_factorize(n):
        res = set()
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.add(i)
        if n != 1:
            res.add(n)
        return res

    pf_N = prime_factorize(N)
    pf_M = prime_factorize(M)

    ans = 1 + len(pf_N & pf_M)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62788
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

int main() {
  // cout << fixed << setprecision(10);

  int N; scanf("%d", &N);
  vector<lli> vals;
  lli mim = infty<lli>, ans = -infty<lli>;
  REP(i, N) {
    lli R; scanf("%lld", &R);
    chmax(ans, R - mim);
    chmin(mim, R);
  }
  printf("%lld\n", ans);
  return 0;
}



Measured memory_bytes: 3228
//
// Created by tac on 2016/10/12.
//
#include <cstdlib>
#include <string>
#include <iostream>

std::string get_in_circle(int w, int h, int x, int y, int r) {
    std::string res;
    if (x >= 0 + r && y >= 0 + r && x <= w -r && y <= h - r) {
        res = std::string {"Yes"};
    } else {
        res = std::string {"No"};
    }
    return res;
}

int main() {
    int w, h, x, y, r;
    std::cin >> w >> h >> x >> y >> r;
    std::cout << get_in_circle(w, h, x, y, r) << std::endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3168
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


    class Program
    {
        static void Main(string[] args)
        {
          int N = int.Parse(Console.ReadLine());
          var list = new List<string>{};
          for(int i = 0; i < N; i++)
          {
            var Input = Console.ReadLine();
            list.Add(Input);
          }
          string[] list2 = list.Distinct().ToArray();
          Console.WriteLine(list2.Length);
        }
    }

Measured memory_bytes: 42948
#include <stdio.h>
#include <string.h>
#define N 110
int n;
int m[N][N];
int used[N];
int time = 1;
int start[N];
int end[N];
void dfs(int u){
    used[u] = 1;
    start[u] = time++;
    for(int v = 1; v <= n; v++){
        if(used[v] == 0 && m[u][v]){
            dfs(v);
        }
    }
    end[u] = time++;
}
int main(){
    for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) m[i][j] = 0;
    for(int i = 0; i < N; i++) used[i] = 0;
    scanf("%d", &n);
    for(int p = 0; p < n; p++){
        int node, k;
        scanf("%d %d", &node, &k);
        for(int i = 0; i < k; i++){
            int b;
            scanf("%d", &b);
            m[node][b] = 1;
        }
    }

    for(int i = 1; i<= n; i++) if(used[i] == 0) dfs(i);
    for(int i = 1; i <= n; i++){
        printf("%d %d %d\n", i, start[i], end[i]);
    }
    return 0;
}


Measured memory_bytes: 2804
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

const int N = 1005, INF = 1e9;
string grid[N];
int dis[N][N];

int main() {
#ifdef LOCAL_EXEC
//	freopen("sample.in", "r", stdin);
//	freopen("sample.out", "w", stdout);
#else
  ios_base::sync_with_stdio(false); cin.tie(NULL);
#endif

  int h, w; cin >> h >> w;
  int sx, sy; cin >> sx >> sy;
  int ex, ey; cin >> ex >> ey;

  for (int i = 1; i <= h; i++) {
    string s; cin >> s;
    grid[i] = "#" + s;
    for (int j = 1; j <= w; j++) {
      dis[i][j] = INF;
    }
  }

  const vector<PII> moves {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};

  deque<PII> Q;
  dis[sx][sy] = 0;
  Q.emplace_back(sx, sy);
  while (!Q.empty()) {
    auto [x, y] = Q.front(); Q.pop_front();
    for (auto [dx, dy] : moves) {
      if (x + dx >= 1 && x + dx <= h && y + dy >= 0 && y + dy <= w) {
        if (grid[x + dx][y + dy] == '.'
            && dis[x + dx][y + dy] > dis[x][y]) {
          dis[x + dx][y + dy] = dis[x][y];
          Q.emplace_front(x + dx, y + dy);
        }
      }
    }
    for (int xx = max(1, x - 2); xx <= min(h, x + 2); xx++) {
      for (int yy = max(1, y - 2); yy <= min(w, y + 2); yy++) {
        if (grid[xx][yy] == '.'
            && dis[xx][yy] > dis[x][y] + 1) {
          dis[xx][yy] = dis[x][y] + 1;
          Q.emplace_back(xx, yy);
        }
      }
    }
  }

  int ans = dis[ex][ey];
  if (ans == INF) ans = -1;
  cout << ans << '\n';

  return 0;
}


Measured memory_bytes: 8724
import java.io.*;
import java.util.*;
import java.lang.Math.*;

public class Main{ 
    
    public static void main(String[] args)throws IOException{
	try{
	InputStreamReader isr = new InputStreamReader(System.in);
	BufferedReader br=new BufferedReader(isr);
	String line;
	while((line=br.readLine())!=null){
	    int n = Integer.parseInt(line);
	    int x=1;
	    boolean flag = true;
	    while(n!=0){
		if(n%2==1){
		    if(flag){
		    System.out.print(x);
		    flag=false;
		    }
		    else{
			System.out.print(" "+x);
		    }
		}
		n/=2;x*=2;
		
		
	    }
	    System.out.println();
	}
	}catch(java.lang.NumberFormatException e){
	    System.out.println(e);
	}
    }
}

Measured memory_bytes: 16888
N,M,Q=map(int,input().split())
A=[list(map(int,input().split())) for i in range(Q)]
ans=0
def make(N,ans):
  def saiki(i,j,_,ans):
    if i==N-1:
      for k in range(j,M+1):
        _[i]=k
        _ans=0
        for a in A:
          if _[a[1]-1]-_[a[0]-1]==a[2]:
            _ans+=a[3]
        ans=max(ans,_ans)
        #print(_)
      return ans
    for k in range(j,M+1):
      _[i]=k
      ans=saiki(i+1,k,_,ans)
    return ans

  _=[1]*N
  i=0
  for j in range(1,M+1):
    ans=saiki(i,j,_,ans)
  return ans
ans=make(N,-1)
print(ans)



Measured memory_bytes: 9252
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define n_p(v) next_permutation(v.begin(),v.end())
#define to_ll(b) stoll(b)
#define MOD 1000000007
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	int sx,sy,tx,ty; cin>>sx>>sy>>tx>>ty;
	string ans;
	rep(i,0,ty-sy) ans.push_back('U');

	rep(i,0,tx-sx) ans.push_back('R');
			
	rep(i,0,ty-sy) ans.push_back('D');
	
	rep(i,0,tx-sx+1) ans.push_back('L');
	
	rep(i,0,ty-sy+1) ans.push_back('U');
	
	rep(i,0,tx-sx+1) ans.push_back('R');
	
	ans.push_back('D');
	ans.push_back('R');
	
	rep(i,0,ty-sy+1) ans.push_back('D');
	
	rep(i,0,tx-sx+1) ans.push_back('L');
	
	ans.push_back('U');
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d %d", $a11, $a12, $a13);
fscanf(STDIN, "%d %d %d", $a21, $a22, $a23);
fscanf(STDIN, "%d %d %d", $a31, $a32, $a33);

$list = [
	$a11, $a12, $a13,
	$a21, $a22, $a23,
	$a31, $a32, $a33,
];
$ans = array_fill(0, 9, false);

fscanf(STDIN, "%d", $N);
for($i = 0; $i < $N; $i++) {
	fscanf(STDIN, "%d", $b);
	$idx = array_search($b, $list);
	if($idx !== false) {
		$ans[$idx] = true;
	}
}

// たてよこ
$flg = false;
for($i = 0; $i < 3; $i++) {
	$flg |= ($ans[$i * 3 + 0] && $ans[$i * 3 + 1] && $ans[$i * 3 + 2]);
	$flg |= ($ans[0 * 3 + $i] && $ans[1 * 3 + $i] && $ans[2 * 3 + $i]);
}

// 斜め
$flg |= ($ans[0] && $ans[4] && $ans[8]);
$flg |= ($ans[2] && $ans[4] && $ans[6]);

if($flg) {
	echo "Yes\n";
}
else {
	echo "No\n";
}


Measured memory_bytes: 4604
n = int(input())
h = list(map(int, input().split()))
m = 0
i = 0
j = 0
while i < n-1:
    if h[i] >= h[i+1]:
        i += 1
        j += 1
    else:
        if j > m:
            m = j
        j = 0
        i += 1
if j > m:
    m = j
print(m)

Measured memory_bytes: 63856
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
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 << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int K, N;
    cin >> K >> N;
    vector<int> A(N);
    REP (i, N) {
        cin >> A[i];
    }

    ans = K - A[0] - (K - A[N-1]);
    REP(i,N-1) ans = min(ans, K - (A[i+1] - A[i]));
    pa;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_c && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_c && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc160/abc160_c && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
long long cnt,sum,a[200005],b[200005];
vector<int> c;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(){
	int n;cin>>n;
	rep(i,n) cin>>a[i];
	rep(i,n){
        cin >> b[i];
		if(a[i]>=b[i])c.push_back(a[i]-b[i]);
		else{
			sum+=(b[i]-a[i]);cnt++;
		}
	}
	sort(c.rbegin(),c.rend());
	rep(i,c.size()){
		if(sum>0) {
          sum-=c[i];cnt++;
		}
	}
	if(sum>0)cnt=-1;
	cout<<cnt;
}

Measured memory_bytes: 2172
#include<bits/stdc++.h>
using namespace std;
char a[150000],c;
int main(){
	int k,m=0;
	cin>>a;
	c=a[0];
	k=strlen(a);
	for(int i=1;i<k;i++){
		if(a[i]!=c){
			m++;
			c=a[i];
		}
	}
	cout<<m;
	cout<<endl;
	return 0;
}

Measured memory_bytes: 384
n = gets.to_i
x = gets.chomp.split(" ").map(&:to_i)
ans = Float::INFINITY
(1..100).each do |i|
    count = 0
    (0...n).each do |j|
        count += (x[j] - i) ** 2 
    end
    ans = [ans,count].min
end
puts ans

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

using namespace std;

int main(){
    string s;
    cin >> s;
    long long s1=0,s0=0;
    int state = 1;
    for(int i=0;i<int(s.size());i++){
        if(state == 1){
            if(s[i] == '0'){
                s1++;
            }else{
                s0++;
            }
        }else{
            if(s[i] ==  '0'){
                s0++;
            }else{
                s1++;
            }
        }
        state *= -1;
    }
    cout << min(s0,s1) << endl;
}


Measured memory_bytes: 512
import java.util.*;
public class Main {
    static int lowerBound(int a[], int v) {
        int l = 0, r = a.length - 1;
        while (r - l >= 0) {
            int c = (l + r) / 2;
            if (v <= a[c]) {
                r = c - 1;
            } else {
                l = c + 1;
            }
        }
        return l;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int A[] = new int[N], B[] = new int[N];
        for (int n = 0; n < N; n++) {
            A[n] = sc.nextInt();
        }
        for (int n = 0; n < N; n++) {
            B[n] = sc.nextInt();
        }
        int ans = 0;
        for (int k = 0; k < 30; k++) {
            int[] a = Arrays.copyOf(A, N);
            int[] b = Arrays.copyOf(B, N);
            for (int i = 0; i < N; i++) {
                a[i] &= (1 << (k + 1)) - 1;
                b[i] &= (1 << (k + 1)) - 1;
            }
            int count = 0;
            Arrays.sort(b);
            for (int i = 0; i < N; i++) {
                int k1 = lowerBound(b, (1 << k) - a[i]);
                int k2 = lowerBound(b, (1 << (k + 1)) - a[i]);
                count += k2 - k1;
                if (k >= 1) {
                    int k3 = lowerBound(b, (3 << k) - a[i]);
                    count += N - k3;
                }
                count %= 2;
            }
            if (count % 2 == 1) {
                ans |= 1 << k;
            }
        }
        System.out.println(ans);
        sc.close();
    }
}


Measured memory_bytes: 150336
use proconio::input;

fn main() {
    input! {
        s: String,
    }

    let x = s.chars().collect::<Vec<char>>();

    for i in 0..x.len() {
        if x[i] != x[x.len() - (i + 1)] {
            println!("No");
            return;
        }
    }

    let s = x.len();

    for i in 0..(s / 2) {
        if x[i] != x[(s / 2) - (i + 1)] {
            println!("No");
            return;
        }
    }

    for i in (s / 2)..s {
        if x[i] != x[s - (i + 1)] {
            println!("No");
            return;
        }
    }

    println!("Yes");
}


Measured memory_bytes: 2132
#include"bits/stdc++.h"
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define INF 1e+9

struct three {
	int x;
	int y;
	int judge;
	bool operator<(const three& right)
		const {
		return x == right.x ? y > right.y:x < right.x;
	}
};

struct threee {
	int x;
	int y;
	int judge;
	bool operator<(const threee& right)
		const {
		return x == right.x ? y < right.y:x < right.x;
	}
};

int main() {
	int n,a,b;
	vector<three> rp;
	vector<threee> bp;
	three c;
	threee d;
	cin >> n;

	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		c = { a,b,0 };
		rp.push_back(c);
	}
	sort(rp.begin(), rp.end());

	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		d = { a,b,0 };
		bp.push_back(d);
	}
	sort(bp.begin(), bp.end());

	int maxy,use_num,ans=0;
	for (int i = 0; i < n; i++) {
		maxy = 0;
		use_num = -1;
		for (int j = 0; j < n; j++)
		{
			if (rp[j].x >= bp[i].x) break;
			if (rp[j].y < bp[i].y&&rp[j].y >= maxy&&rp[j].judge==0) { use_num = j; maxy = rp[j].y; }
		}
		if (use_num == -1) continue;
		else {
			ans++;
			rp[use_num].judge = 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;
typedef long long ll;
typedef pair<ll,ll> P;

const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 1000000007;

ll n, a, b;
ll ans[300001];
bool saw[300001];

vector<ll> out;

void solve() {
    memset(saw, 0, sizeof(saw));
    if (n < a || n < b) {
        cout << -1 << endl;
        return;
    }
    if (n/a+(n%a!=0) > b) {
        cout << -1 << endl;
        return;
    }
    if (a+b-1 > n) {
        cout << -1 << endl;
        return;
    }
    ll cnt = 0;
    for (ll i = 0; i < n; ) {
        bool f = true;
        ll add = 0;
        for ( ; i < min(cnt*a+a,n); i++) {
            ans[i] = n-(cnt+1)*a+(i-cnt*a)+1;
            if (f) {
                if (ans[i] <= 0) add = 1-ans[i];
            }
            ans[i] += add;
            f = false;
        }
        cnt++;
    }
    b -= n/a+(n%a!=0);
    rep(i,a) out.push_back(ans[i]);
    for (ll i = a; i < n; i += a) {
        for (ll j = i; j < min(i+a, n)-1; j++) {
            if (b != 0) {
                out.push_back(ans[min(i+a,n)-1-(j-i)]);
                saw[min(i+a,n)-1-(j-i)] = true;
                b--;
            } else {
                break;
            }
        }
        for (ll j = i; j < min(i+a, n); j++) {
            if (!saw[j]) {
                out.push_back(ans[j]);
            }
        }
    }
    rep(i,out.size()) {
        cout << out[i];
        if (i == out.size()-1) cout << endl;
        else cout << " ";
    }
    //rep(i,n) cout << ans[i] << " ";
    //cout << endl;
}

int main() {
    cin >> n >> a >> b;
    solve();
}

/*

int main () {
    for (int i = 1; i < 100; i++) {
        for (int j = 1; j <= i; j++) {
            for (int k = 1; k <= i; k++) {
                n = i;
                a = j;
                b = k;
                out.clear();
                solve();
                if (out[0] == -1) continue;
                int dp[100];
                int cnt1 = 0;
                rep(u,100) dp[u] = 1000;
                rep(u,out.size()) {
                    rep(v,i) {
                        if (dp[v] > out[u]) {
                            dp[v] = out[u];
                            cnt1 = max(cnt1, v+1);
                            break;
                        }
                    }
                }
                int cnt2 = 0;
                rep(u,100) dp[u] = 1000;
                rep(u,out.size()) {
                    rep(v,i) {
                        if (dp[v] > out[u]*-1) {
                            dp[v] = out[u]*-1;
                            cnt2 = max(cnt2, v+1);
                            break;
                        }
                    }
                }
                if (j != cnt1 || k != cnt2) {
                    cout << i << " " << j << " " << k << endl;
                    rep(u,out.size()) cout << out[u] << " ";
                    cout << endl;
                    return 0;
                }
            }
        }
    }
}


*/




























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

using namespace std;

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

  for (int i = 0; i < N; i++) {
    if (A[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }

  long double answer = 1;
  for (int i = 0; i < N; i++) {
    answer *= A[i];
    if (answer > 1e18) {
      cout << -1 << endl;
      return 0;
    }
  }

  printf("%ld\n", (int64_t)answer);

  return 0;
}


Measured memory_bytes: 4056
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using o_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) find_by_order(i)
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
using cd = complex<double>;
const double pi = acos(-1);
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);

void solve(){
    int n;
    cin >> n;
    map<pair <int, int>, int > m;
    int ans = 0;
    rep(j, 0, n){
        long double a;
        cin >> a;
        ll x = llround(a*1e9);
        int c = 9;
        rep(i, 0, 9){
            if(x%10)break;
            x /= 10;
            c--;
        }
        int p = 0, q = 0;
        while(x%2 == 0)x /= 2, p++;
        while(x%5 == 0)x /= 5, q++;
        m[{p-c, q-c}]++;
    }
    for(auto i : m)for(auto j : m){
        if(i.fi.fi +j.fi.fi >= 0  and i.fi.si + j.fi.si >= 0)ans += i==j?i.si*(i.si-1):(i.si*j.si);
    }
    cout << ans/2 << endl;
}
signed main() {
    cin.sync_with_stdio(0); cin.tie(0);
	cin.exceptions(cin.failbit);
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3748
/* 
* ID: juryc
* PROG: Count ABC
* LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
string s; cin>>s;
int cnt=0;
for(int i=2;i<n;i++){
if(s[i]=='C'&&s[i-1]=='B'&&s[i-2]=='A') cnt++; 
}
cout<<cnt<<"\n"; 
return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
typedef long long ll;

int main(int argc, char const *argv[]) {
    ll a, b, c;
    std::cin >> a >> b >> c;
    ll max = std::max({a, b, c});
    if (a + b + c == max * 2) {
        std::cout << "Yes" << '\n';
    } else {
        std::cout << "No" << '\n';
    }

    return 0;
}


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

int main(int argc, char const *argv[])
{
	int N ;
	cin>>N ;

	vector<int> A(N+1) ;
	vector<int> B(N) ; 

	for(int i = 0 ; i <  N+1 ; i++) cin>>A[i] ;
	for(int i = 0 ; i < N ; i++) cin>>B[i] ;

	long long int final = 0 ;
	
	for(int i = 0 ; i < N ; i++)
	{
		final+= min(A[i],B[i]) ;
		if(A[i] >= B[i]){ A[i]-=B[i] ; B[i] = 0 ; }
		else {B[i]-=A[i] ; A[i]= 0 ;}

		if(B[i])
		{
			final+= min(A[i+1],B[i]) ; 
			if(A[i+1] >= B[i]) A[i+1]-=B[i] ;
			else A[i+1] = 0 ;
		}
	}

	cout<< final ;

	return 0;
}

Measured memory_bytes: 1024
def main():
    S = input()
    idx1 = int((len(S) - 1)/2)
    idx2 = int((len(S) + 3)/2) - 1
    flag1 = check(S)
    flag2 = check(S[:idx1])
    flag3 = check(S[idx2:])
    if flag1 and flag2 and flag3:
        print("Yes")
    else:
        print("No")


def check(s):
    if s == s[::-1]:
        return True
    else:
        return False


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;

int main(){
  int n,v[100],c[100],ans=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>v[i];  
  }
  for(int i=0;i<n;i++){
    cin>>c[i];
  }

  for(int i=0;i<n;i++){
    if(v[i]-c[i]>0) ans+=v[i]-c[i];
  }
  cout<<ans<<endl;

}


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

typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,int> pli;

void solve();
bool pro(int x);

int N;
int ans = 0;

vector<pii> V;

int main()
{
    scanf("%d",&N);
    for(int i = 0; i < N; i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        V.push_back(make_pair(a,b));
    }
    sort(V.begin(),V.end());
    solve();
    return 0;
}

void solve()
{
    int l,r;
    l = 1;r = N + 1;
    while(r - l > 0)
    {
        int now = (l + r) / 2;
        if(pro(now))
        {
            ans = max(ans,now);
            l = now + 1;
        }
        else
        {
            r = now;
        }
    }
    printf("%d\n",ans);
    return;
}

bool pro(int x)
{
    ll sum = 0;
    int mi = 1;
    pli mem[100010];
    int now = 0;
    for(int i = 0; i < N; i++)
    {
        if(V[i].second < mi)continue;
        sum += V[i].first;
        now++;
        mem[V[i].second].first += V[i].first;
        mem[V[i].second].second++;
        int ma = (sum + x - 1) / x;
        if(ma < mi);
        else
        {
            for(int j = mi; j < ma; j++)
            {
                sum -= mem[j].first;
                now -= mem[j].second;
            }
            mi = ma;
        }
        if(now >= x)return true;
    }
    return false;
}

Measured memory_bytes: 6984
import scala.io.StdIn.{readInt, readLine}
import scala.reflect.ClassTag
case class Node[A](data: A, var next: Option[Node[A]])
class Dictionary[A](val size: Int)(implicit m: ClassTag[Option[Node[A]]]) {
    val dict: Array[Option[Node[A]]] = m.newArray(size).map(a => None)
    
    def insert(target: A): Unit = {
        val index = target.hashCode.abs % size
        def go(node: Option[Node[A]]): Unit = node match {
            case None => dict(index) = Option(new Node[A](target, None))
            case Some(a) if a.data != target => a.next match {
                case None => a.next = Option(new Node[A](target, None))
                case _ => go(a.next)
            }
            case _ => ()
        }
        go(dict(index))
    }
    def find(target: A): Boolean = {
        val index = target.hashCode.abs % size
        def go(node: Option[Node[A]]): Boolean = node match {
            case None => false
            case Some(a) => if (a.data == target) true else go(a.next)
        }
        go(dict(index))
    }
    override def toString(): String = {
        def nodeToString(node: Option[Node[A]]): String = node match {
            case None => "None"
            case Some(a) => a.data + " -> " + nodeToString(a.next)
        }
        val sb = new StringBuilder()
        (0 until dict.length).foldLeft(sb) {(builder, idx) =>
            builder.append(idx + " : ")
            dict(idx) match {
                case None => builder.append("None")
                case node => builder.append(nodeToString(node))
            }
            builder.append("\n")
        }
        sb.toString
    }
    
}
object Dictionary {
    def apply[A](size: Int): Dictionary[A] = new Dictionary(size)
}
object Main {
    def main(args: Array[String]): Unit = {
        val len = readInt
        val dict = Dictionary[String](len)
        val l = (1 to len).foldLeft(Nil: List[String]) { (list, dummy) => 
            readLine.split(" ") match {
                case Array("insert", v) => dict.insert(v); list
                case Array("find", v) => dict.find(v) match {
                    case true => "yes" :: list
                    case false => "no" :: list
                }
            }
        }
        println(l.reverse.mkString("\n"))
    }
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int x, a, b;
	cin >> x >> a >> b;
	if (abs(x - a) > abs(x - b))cout << 'B' << endl;
	else cout << 'A' << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,a,b) for (int i=(a),for_##i##_max=(b);i<=(for_##i##_max);++i)
#define RFOR(i,a,b) for (int i=(a),rfor_##i##_min=(b);i>=(rfor_##i##_min);--i)
#define REP(i,n) for (int i=0,rep_##i##_len=(n);i<(rep_##i##_len);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

namespace { // Basics

template<typename T>
void chmin(T &x, T y) {
  x = std::min(x, y);
}

template<typename T>
void chmax(T &x, T y) {
  x = std::max(x, y);
}

template<typename T>
__attribute__((unused))
const auto minimum = static_cast<T const &(*)(T const &, T const &)>(std::min);

template<typename T>
__attribute__((unused))
const auto maximum = static_cast<T const &(*)(T const &, T const &)>(std::max);

template<typename T>
int cmp3(T lhs, T rhs) { return (lhs == rhs) ? 0 : (lhs > rhs) ? 1 : -1; }

template<typename T>
__attribute__((unused))
T constexpr infty = std::numeric_limits<T>::max / 3;
template<>
__attribute__((unused))
auto constexpr infty<int> = 1'100'100'100;
template<>
__attribute__((unused))
auto constexpr infty<long long int> = 100'500'400'300'200'100LL;

using lli = long long int;
using ld = long double;

} // namespace

using namespace std;

lli solve(int n, int limit, vector<tuple<lli,lli>> &jewels) {
  vector<lli> dp(limit+1, 0);
  for (auto &&jwl : jewels) {
    lli w, v; tie(w, v) = jwl;
    RFOR(i, limit, w) {
      chmax(dp[i], dp[i-w]+v);
    }
  }
  return dp[limit];
}

int main() {
  int N, W; cin >> N >> W;
  vector<tuple<lli,lli>> jewels;
  REP(i, N) {
    int W, V; cin >> W >> V;
    jewels.emplace_back(W, V);
  }
  cout << solve(N, W, jewels) << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define ll long long
int main(){
  int N,A,B,C,D;
  cin>>N>>A>>B>>C>>D;
  string S;
  cin>>S;
  int Q=0,W=0;
  rep(i,C-A){
    if(S[A-1+i]=='#'&&S[A+i]=='#'){
      Q=1;
      break;
    }
  }
  rep(i,D-B){
    if(S[B-1+i]=='#'&&S[B+i]=='#'){
      W=1;
      break;
    }
  }
  int E=0;
  if(C>D){
    rep(i,D-B+1){
      if(S[B-2+i]=='.'&&S[B-1+i]=='.'&&S[B+i]=='.'){
        E=1;
        break;
      }
    }
  }
  if(C<D){
    if(Q||W) cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
  }else{
    if(Q||W) cout<<"No"<<endl;
    else if(E) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }
}

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

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

typedef long long ll;

#define MAX_N 10000

struct Edge {
    int to;
    int weight;
    Edge(int t, int w)
        : to(t)
        , weight(w)
    {
    }
};
using Graph = vector<vector<int>>;
using Graph_e = vector<vector<Edge>>;

vector<int> dx = { 1, 0, -1, 0 };
vector<int> dy = { 0, 1, 0, -1 };
typedef pair<int, int> P;

int main()
{
    int H, W;
    cin >> H >> W;
    vector<string> field(H);
    rep(i, H) cin >> field.at(i);

    int max = 0;

    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            vector<vector<int>> dist(H, vector<int>(W, -1));
            queue<P> que;

            if (field.at(y).at(x) == '#')
                continue;

            que.push(make_pair(x, y));
            dist.at(y).at(x) = 0;

            int tempMax = 0;
            while (!que.empty()) {
                P v = que.front();
                que.pop();

                int cx = v.first;
                int cy = v.second;
                for (int i = 0; i < 4; i++) {
                    int nx = cx + dx.at(i);
                    int ny = cy + dy.at(i);
                    if (nx < 0 || nx >= W || ny < 0 || ny >= H)
                        continue;
                    if (field.at(ny).at(nx) == '#')
                        continue;
                    if (dist.at(ny).at(nx) != -1)
                        continue;

                    dist.at(ny).at(nx) = dist.at(cy).at(cx) + 1;
                    chmax(tempMax, dist.at(ny).at(nx));
                    que.push(make_pair(nx, ny));
                }
            }
            chmax(max, tempMax);
        }
    }
    cout << max << endl;
}


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

using namespace std;

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

  int m;
  cin >> m;
  
  int p[m], x[m];

  for(int i = 0; i < m; i++)
    cin >> p[i] >> x[i];

  int sum = 0;
  for(int i = 0; i < n; i++)
    sum += t[i];

  for(int i = 0; i < m; i++){
    cout << sum - t[p[i]-1] + x[i] << endl;
  }

}


Measured memory_bytes: 256
use std::io::{stdin, Read};

#[allow(unused_macros)]
macro_rules! parse {
    ($it: ident ) => {};
    ($it: ident, ) => {};
    ($it: ident, $var:ident : $t:tt $($r:tt)*) => {
        let $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
    ($it: ident, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = parse_val!($it, $t);
        parse!($it $($r)*);
    };
}

#[allow(unused_macros)]
macro_rules! parse_val {
    ($it: ident, [$t:tt; $len:expr]) => {
        (0..$len).map(|_| parse_val!($it, $t)).collect::<Vec<_>>();
    };
    ($it: ident, ($($t: ty),*)) => {
        ($(parse_val!($it, $t)),*)
    };
    ($it: ident, $t: ty) => {
        $it.next().unwrap().parse::<$t>().unwrap()
    };
}

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    parse!(it, a: usize, b: usize);
    println!("{}", a * b);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}


Measured memory_bytes: 2108
#include<stdio.h>

int main(void){

    int H,W,A,B,i,j;

    scanf("%d %d %d %d",&H,&W,&A,&B);

    for(i = 1;i <= H;i++){
        for(j = 1;j <= W;j++){
            if(i <= B){
                (j <= A) ? printf("0") : printf("1");
            }else{
                (j <= A) ? printf("1") : printf("0");
            }
        }
        printf("\n");
    }

    return 0;
}

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

int main(){
    int x, y, z;
    cin >> x >> y >> z;
    int a;
    a = x;
    x = y;
    y = a;
    a = x;
    x = z;
    z = a;
    cout << x <<" "<< y <<" "<< z << endl;
    return 0;
}

Measured memory_bytes: 256
object Main {
  def main (args: Array[String]) {
    val Array(v1, v2) = scala.io.StdIn.readLine.split(" ").map(_.toLong)
    println( f"${v1/v2}%d ${v1%v2}%d ${v1.toDouble/v2.toDouble}%.5f" )
  }
}

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<"\n"
#define  hexformat(fill, wd)  std::hex<<std::setfill(fill)<<std::setw(wd)
int main(){
    int n,m;
    cin >> n >> m;
    int count = 0;
    vector<int> ball(n,1);
    vector<bool> ex(n,0);ex[0] = 1;
    int a,b;
    REP(i,m){
        cin >> a >> b;
        ball[a-1]--;
        ball[b-1]++;
        if(ex[a-1]==1)ex[b-1]=1;
        if(ball[a-1]==0)ex[a-1]=0;
    }
    REP(i,n){
        if(ex[i]==1)count++;
    }
    COUT(count);
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int s[1000000];
double n,m,d;
int main() {
    while(cin >> n >> m >> d) {
        if(d==0)  printf("%.10f\n",(m - 1) / n);
        else {
           double  cha = n - d;
            printf("%.10f\n",(m - 1) * 2 * cha * 1.0 / (n * n));
        }
    }
    return 0;
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
      int k;
      cin>>k;
      cout<<a[k-1]<<endl;

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramE
    {
        static void Main()
        {
            int n = NextInt, m = NextInt;
            var uf = new UnionFind(n);

            for (int i = 0; i < m; i++)
            {
                int x = NextInt - 1, y = NextInt - 1, z = NextInt;
                uf.Unite(x, y);
            }

            System.Console.WriteLine(Enumerable.Range(0, n).Select(i => uf.Find(i)).Distinct().Count());
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}

namespace Library
{

    public class UnionFind
    {
        public int[] Parents { get; set; }
        public UnionFind(int size)
        {
            Parents = Enumerable.Repeat(-1, size).ToArray();
        }

        public int Find(int num)
        {
            if (Parents[num] < 0) return num;

            Parents[num] = Find(Parents[num]);
            return Parents[num];
        }

        public int Size(int num)
        {
            return -Parents[Find(num)];
        }

        public bool Same(int a, int b)
        {
            return Find(a) == Find(b);
        }

        public void Unite(int a, int b)
        {
            int x = Find(a), y = Find(b);
            if (x == y) return;

            if (Size(x) > Size(y))
            {
                Parents[x] += Parents[y];
                Parents[y] = x;
            }
            else
            {
                Parents[y] += Parents[x];
                Parents[x] = y;
            }
        }
    }
}


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

int Dig(int n){
	int num = 1;
	for(int i=1; i<n; i++){
		num *= 10;
	}
	return num;
}

int main(){
	char S[10];
	scanf("%s",&S);
	int num = 0;
	int dig = strlen(S);
	num = atoi(S);
	int X = num;
	int a[dig];
	int sum = 0;

	for(int i=0; i<dig; i++){
		a[dig] = num / Dig(dig-i);
		sum += a[dig];
		num -= a[dig]*Dig(dig-i); 
	}
	if(X % sum == 0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

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

using namespace std;

using ll = long long;

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

    set<int> s;
    for (int i = 0; i < n; i++) s.insert(i);

    vector<int> height(n);
    for (int i = 0; i < n; i++) cin >> height[i];

    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        if (height[a] >= height[b]) s.erase(b);
        if (height[a] <= height[b]) s.erase(a);
    }

    cout << s.size() << endl;

    return 0;
}

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

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

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

int main(){

    ll x, y; cin >> x >> y;

    if((x+y)%3 != 0){
        cout << 0 << endl;
        return 0;
    }

    ll m = (2*x-y)/3;
    ll n = x-2*m;

    combinit();
    cout << comb(n+m, n) << endl;

    return 0;
}

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

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

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

const int inf = 1e9;
const ll linf = 1e18;
const ll mod = 1e9 + 7;

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

  rep(i, s.size()-1){
    if(s[i] == s[i+1]){
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
    
    if(i < s.size()-2){
      if(s[i] == s[i+2]){
        cout << i+1 << " " << i+3 << endl;
        return 0;
      }
    }
  }

  cout << "-1 -1" << endl;

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
    int n,i;
    int max,min;
    long sum;
    i = 0;
    cin >> n;
    int a[n];
    while(i<n){
        cin >> a[i];
        i += 1;
       }
    max = a[0];
    min = a[0];
    sum = 0;
    for(int j = 0;j<n;j++){
        if(max < a[j]){
            max = a[j];
        }
        if(min > a[j]){
            min = a[j];
        }
        sum += a[j];
    }
    cout << min << " " << max << " " << sum << "\n";
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin>>s;
	vector<int>vec;
	for(int i=0;i<s.size();i++){
		vec.push_back(s[i]-'a');
	}
	for(int i=0;i<26;i++){
		bool bo=true;
		for(int j=0;j<vec.size();j++){
			if(i==vec.at(j)){
				bo=false;
			}
		}
		if(bo){
			char a='a'+i;
			cout<<a<<endl;
			return 0;
		}
	}
	cout<<"None"<<endl;
}

Measured memory_bytes: 1020
//
//  main.cpp
//  countest
//
//  Created by Reza Godarzi on 11/29/1397 AP.
//  Copyright © 1397 w. All rights reserved.
//
#include <iostream>
#include <set>
#include<math.h>
#include <algorithm>
#include <vector>
#define ll long long
using namespace std ;
const ll N=1e5+10;
#define needforspeed   ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
int main(){
    needforspeed;
    ll n;
    cin>>n;
    ll b[N],a[N],ans[N],j=0;
    for(ll i=0;i<n;i++){
        cin>>a[i]>>b[i];
        j-=b[i];
        ans[i]=a[i]+b[i];
    }
    sort(ans,ans+n,greater<ll>());
    for(ll i=0;i<n;i+=2){
        j+=ans[i];
    }
    cout<<j<<'\n';
}


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

int main(){
    string s, t;
    cin >> s >> t;
    int ans = 0;

    rep(i, 3){
        if(s[i]==t[i])ans++;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256