akhauriyash/Code-Regression huggingface dataset:
package main

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

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

// 見当つかなかったので解説見たりググったりした

func main() {
	N := nextInt()
	An := make([]int, N)
	Bn := make([]int, N)
	var sumA, sumB, sumBAdiff, ans int
	ABdiff := make([]int, N)
	for i := range An {
		An[i] = nextInt()
		sumA += An[i]
	}
	for i := range Bn {
		Bn[i] = nextInt()
		sumB += Bn[i]
	}
	if sumA < sumB {
		fmt.Println(-1)
		return
	}
	for i := 0; i < N; i++ {
		if An[i] >= Bn[i] {
			ABdiff[i] = An[i] - Bn[i]
		} else {
			sumBAdiff += Bn[i] - An[i]
			ans++
		}
	}
	if ans == 0 {
		fmt.Println(0)
		return
	}
	sort.Sort(sort.Reverse(sort.IntSlice(ABdiff)))
	for i, d := range ABdiff {
		sumBAdiff -= d
		if sumBAdiff <= 0 {
			fmt.Println(ans + i + 1)
			return
		}
	}
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


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

int main()
{
  int n,minv,maxv,i,j,a[200000];

  scanf("%d",&n);
  
  for(i = 0;i < n;i++)
    scanf("%d",&a[i]);

  minv = a[0];
  maxv = -1000000000;
  for(j = 1;j <= n - 1;j++)
    {
      if(maxv < a[j] - minv)
	maxv = a[j] - minv;

      if(minv > a[j] )
	minv = a[j];
    }
  printf("%d\n",maxv);

  return 0;
}
	  



Measured memory_bytes: 2580
#include <stdio.h>
#include <string.h>
int a[1001][1300];
int main(void)
{
    int N, M, r, q;
    while (scanf("%d%d%d", &N, &M, &r), N) {
        memset(a, 0, sizeof(a));
        while (r--) {
            int t, n, m, s;
            scanf("%d%d%d%d", &t, &n, &m, &s);
            if (s) {
                a[n][t]=m;
            }
            else {
                int i;
                for(i=t-1;a[n][i]!=m;--i) a[n][i]=m;
            }
        }
        scanf("%d", &q);
        while (q--) {
            int s, e, m, i, j, res=0;
            scanf("%d%d%d", &s, &e, &m);
            for(j=s;j<e;++j) {
                for(i=1;i<=N;++i) {
                    if (a[i][j]==m) { res++; break; }
                }
            }
            printf("%d\n", res);
        }
    }
    return 0;
}

Measured memory_bytes: 5688
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>

typedef long long ll;

using namespace std;
int main() {
    string s;
    int n, q;
    cin >> n >> q;
    cin >> s;
    vector<int> l(q), r(q);
    for (int i=0; i<q; ++i) cin >> l[i] >> r[i];
    
    vector<int> ct(n,0);
    for (int j=0; j<n-1; ++j){
        ct[j+1] = ct[j];
        if(s[j]=='A' && s[j+1] == 'C') ct[j+1]+=1;
    }
    
    for (int i=0; i<q; ++i){
        cout << ct[r[i]-1] - ct[l[i]-1] << endl;
    }
    return 0;
}

Measured memory_bytes: 2240
import sys
x, y = map(int, input().split())

# aが正なら絶対値を増やすべき、そうでなければ減らすべき
a = abs(y) - abs(x)

# 符号が違うだけなら符号反転して終わり
if a == 0 and x != y:
    print(1)
    sys.exit()

# 最初に符号反転するべきか
push = 0
if (a < 0 and x > 0) or (a > 0 and x < 0):
    push += 1
    x = -x

# 加算
x += abs(a)

# 最後に符号反転するべきか
if x != y:
    push += 1

print(abs(a) + push)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

    if (2 * k > n + 1) {
        cout << -1 << endl;
    } else {
        int m = (n + 1) / 2;
        vector<int> a, b, c;
        rep(i, n)
        {
            c.push_back(k + 2 * n + i);
        }
        rep(i, m)
        {
            a.push_back(k + 2 * i);
            b.push_back(k + n + m - 1 - i);
        }
        rep(i, n - m)
        {
            a.push_back(k + 1 + 2 * i);
            b.push_back(k + 2 * n - 1 - i);
        }

        rep(i, n)
        {
            cout << a[i] << " " << b[i] << " " << c[i] << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3832
# AGC033A - Darker and Darker
from scipy.ndimage import distance_transform_cdt as dist


def main():
    """
    distance_transform_cdt(matric="taxicab"):
        0 0 0    1 1 1
        0 1 0 -> 1 0 1
        0 0 0    1 1 1
    """
    h, w = tuple(map(int, input().rstrip().split()))
    A = list(list(input()) for _ in range(h))
    B = [[1 if i == "." else 0 for i in a] for a in A]
    D = dist(B, metric="taxicab")
    print(D.max())


if __name__ == "__main__":
    main()

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

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputLine = Console.In.ReadLine();
            var inputs = inputLine.Split(new char []{' ','\t','　'});
            if (inputs.Count() != 2)
            {
                return;
            }

            var a = int.Parse(inputs[0]);
            var b = int.Parse(inputs[1]);
            if (false
                || a < 1 || 100 < a
                || b < 1 || 100 < b
                )
            {
                return;
            }

            var area = a * b;
            var primeter = 2 * (a + b);

            Console.WriteLine("{0} {1}", area, primeter);
        }
    }
}


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

/*==========type============*/
typedef long long ll;
typedef std::pair<int,int> pii;
typedef std::pair<ll,ll> pll;
typedef std::pair<std::string,ll> psl;

/*==========constant============*/
#define INF INT_MAX
#define INF_L LONG_MAX
#define INF_LL LLONG_MAX
#define MOD 1000000007

/*==========function============*/
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

using namespace std;

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

    string n;
    cin >> n;
    
    string ans = "bon";
    ll hitoketa = n[n.size()-1] - '0';
    if(hitoketa == 2 || hitoketa == 4 || hitoketa == 5 || hitoketa == 7 || hitoketa == 9){
        ans = "hon";
    }else if(hitoketa == 0 || hitoketa == 1 || hitoketa == 6 || hitoketa == 8){
        ans = "pon"; 
    }
    
    cout << ans << endl;

    return 0;
}    

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using ld = long double;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const long double PI = acos(-1.0L);
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> light(m);
  rep(i, m) {
    int k;
    cin >> k;
    rep(j, k) {
      int s;
      cin >> s;
      --s;
      light[i] |= 1<<s;
    }
  }
  int ok = 0;
  rep(i, m) {
    int p;
    cin >> p;
    ok |= p<<i;
  }
  int ans = 0;
  rep(i, 1<<n) {
    int res = 0;
    rep(j, m) {
      int num = __builtin_popcount(i&light[j]);
      res |= num%2<<j;
    }
    if (res == ok)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
package main

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

var n, k int
var w []int

// 割り当て
func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	str := strings.Split(sc.Text(), " ")
	n, _ = strconv.Atoi(str[0])
	k, _ = strconv.Atoi(str[1])
	w = make([]int, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		w[i], _ = strconv.Atoi(sc.Text())
	}
	p := search()
	fmt.Println(p)
}

func max(p int) int {
	i := 0
	for j := 0; j < k; j++ {
		sum := 0
		for sum+w[i] <= p {
			sum += w[i]
			i++
			if i == n {
				return n
			}
		}
	}
	return i
}

func search() int {
	var left, mid int
	right := 10000 * 100000
	for 1 < right-left {
		mid = (right + left) / 2
		p := max(mid)
		if n <= p {
			right = mid
		} else {
			left = mid
		}
	}
	return right
}



Measured memory_bytes: 2332
#include <iostream>
#include <vector>
#include <unordered_map>

using namespace std;
typedef long long ll;

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

    ll total = 0;
    unordered_map<int, int> d;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        total += a;

        if (d.count(a)) {
            d[a]++;
        }
        else {
            d[a] = 1;
        }
    }
    
    int q;
    cin >> q;
    for (int i = 0; i < q; i++) {
        int b, c;
        cin >> b >> c;

        if (d.count(b)) {
            total += (c - b) * d[b];

            if (d.count(c)) {
                d[c] += d[b];
            }
            else {
                d[c] = d[b];
            }
            
            d.erase(b);
        }
        
        cout << total << endl;
    }

    return 0;
}


Measured memory_bytes: 6668
#include<bits/stdc++.h>
using namespace std;
int n;
#define ran 222222
struct graph{
	int id[ran];
	int ancestor(int x){return x-id[x]?id[x]=ancestor(id[x]):x;}
	void init(int m){
		for(int i=1; i<=n; i++)
			id[i] = i;
		while(m--){
			int x,y;
			scanf("%d%d",&x,&y);
			id[ancestor(x)] = ancestor(y);
		}
		for(int i=1; i<=n; i++)
			ancestor(i);
	}
} g1,g2;
map<pair<int,int>,int> Map;
int main(){
	int m1,m2;
	scanf("%d%d%d",&n,&m1,&m2);
	g1.init(m1);
	g2.init(m2);
	for(int i=1; i<=n; i++){
		Map[make_pair(g1.id[i],g2.id[i])]++;
	}
	for(int i=1; i<=n; i++)
		printf("%d%c",Map[make_pair(g1.id[i],g2.id[i])],i<n?' ':'\n');
	return 0;
}


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

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

typedef long long ll;
using namespace std;
int mod = 1000000007;

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

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll power(int n){
    if(n == 0) return 1;
    ll x = power((n >> 1));
    x = (x*x) % mod;
    if(n % 2) return (x*2) % mod;
    else return x;
}

//N!/(N-A)!A! = N*(N-1)*...*(N-A+1)/A!

int main(void){
    COMinit();
    ll N, A, B; cin >> N >> A >> B;
    //ans = NC1 + NC2 + ... + NCN - NCA - NCB  -> 2^N - 1 - (NCA + NCB)
    ll ans = power(N);
    ll hiku = 0;
    ll temp = 1;
    for(ll i = N; i >= N-A+1; i--) temp = (temp*i) % mod;
    temp = (temp*finv[A]) % mod;
    hiku += temp;
    temp = 1;
    for(ll i = N; i >= N-B+1; i--) temp = (temp*i) % mod;
    temp = (temp*finv[B]) % mod;
    hiku += temp;
    ans--;
    ans = (ans - hiku) % mod;
    if(ans < 0) ans += mod;
    cout << ans << endl;
    return 0;
}

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



namespace std {
	bool solve(int p, int t, vector<int> &v) {
		if (t == 0)
			return true;
		if (t < 0)
			return false;
		if (p == v.size())
			return false;
		return (solve(p+1, t - v[p], v) || solve(p+1, t, v));
	}
} // std



int main() {

	{
		using namespace std;
		int n;
		cin >> n;
		vector<int> A;
		A.resize(n, 0);

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

		int q;
		cin >> q;
		vector<int> M;
		M.resize(q);

		for (int i = 0; i < q; i++)
			cin >> M[i];

		for (int i = 0; i < q; i++) 
			cout << (solve(0, M[i], A) ? "yes" : "no") << endl;

	}

	return 0;
}

Measured memory_bytes: 3104
#include <iostream> 
#include <string>
#include <vector>

using namespace std;

int main() {
	int k;
	string s;
	cin >> k >> s;
	if (s.length() > k) {
		string output = s.substr(0, k);
		cout << output << "...";
	} else {
		cout << s;
	}
	return 0;
}

Measured memory_bytes: 3128
import java.util.*;

public class Main{
    
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        int N =  sc.nextInt();
        int[] A = new int[N];
        int ans = 0;
        for(int i = 0; i < N; i++){
            A[i] = sc.nextInt();
            int count = 0;
            if(A[i]%2 != 0){
                ans = 0;
                break;
            }
            while(A[i]%2 == 0){
                A[i] /= 2;
                count++;
            }
            if(count > 0){
                if(ans == 0)
                    ans = count;
                else
                    ans = Math.min(ans, count);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <array>
using namespace std;
const int inf = 1e9;
const double EPS = 1e-10;
const double INF = 1e18;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()
typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
bool strictItsSP(const L &s, const P &p){
    return abs(cross(s[0]-p, s[1]-p))<EPS  && dot(s[0]-p, s[1]-p)<-EPS;
}
bool overlapSS(const L &a, const L &b){
    return strictItsSP(a, b[0]) || strictItsSP(a, b[1]) ||
        strictItsSP(b, a[0]) || strictItsSP(b, a[1]) ||
        (a[0]==b[0] && a[1]==b[1]) || (a[0]==b[1] && a[1]==b[0]);
}
bool isParallel(const P &a, const P &b){
    return abs(cross(a,b)) < EPS;
}
bool isParallel(const L &a, const L &b){
    return isParallel(a[1]-a[0], b[1]-b[0]);
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        map<string, int> name;
        vector<vector<L> > edge;
        int num = 0;
        for(int i=0; i<n; i++){
            string city;
            cin >> city;
            if(name.count(city) == 0){
                name[city] = num;
                num++;
                edge.push_back(vector<L>());
            }
            VP v;
            while(1){
                int x,y;
                cin >> x;
                if(x == -1) break;
                cin >> y;
                v.push_back(P(x, y));
            }
            for(int j=0; j<(int)v.size(); j++){
                edge[name[city]].push_back(L(v[j], v[(j+1)%v.size()]));
            }
        }

        vector<vector<bool> > adj(num, vector<bool>(num, false));
        for(int i=0; i<num; i++){
            for(int j=i+1; j<num; j++){
                for(int k=0; k<(int)edge[i].size(); k++){
                    for(int l=0; l<(int)edge[j].size(); l++){
                        if(isParallel(edge[i][k], edge[j][l]) && overlapSS(edge[i][k], edge[j][l])){
                            adj[i][j] = adj[j][i] = true;
                            k = edge[i].size();
                            break;
                        }
                    }
                }
            }
        }

        int ans = inf;
        vector<int> ord(num);
        for(int i=0; i<num; i++) ord[i] = i;
        do{
            int count = 1;
            int last = 0;
            for(int i=1; i<num; i++){
                for(int j=last; j<i; j++){
                    if(adj[ord[i]][ord[j]]){
                        count++;
                        last = i;
                        break;
                    }
                }
            }
            ans = min(ans, count);
        }while(next_permutation(ord.begin(), ord.end()));
        cout << ans << endl;
    }
    return 0;
}



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

def main():
    N = int(input())
    A = [int(input()) for i in range(N)]

    dp = [0] * N
    
    for i in range(N):
        if A[i] > 1:
            dp[A[i]-1] = dp[A[i]-2] + 1
        elif A[i] == 1:
            dp[A[i]-1] = 1
    print(N - max(dp))


if __name__ == "__main__":
    main()

Measured memory_bytes: 18888
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int main() {
  int h, n;
  cin >> h >> n;
  vector<int> a(n);
  rep(i,n) cin >> a.at(i);
  
  int sum = 0;
  rep(i,n) sum += a.at(i);
  
  if (sum < h) cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var res = 0;
        for(var i = 0; i < num; i++)
        {
            if (IsPrime(ToInt64(ReadLine())))
                res++;
        }
        WriteLine(res);
    }
    private static bool IsPrime(long num)
    {
        for (var i = 2; i*i<=num; i++)
            if (num % i == 0) return false;
        return true;
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}



Measured memory_bytes: 15984
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
ans=[a,b,c,d,e]
stack=0
m=0
for i in ans:
  stack+=(10-i%10)%10
  m=max(m,(10-i%10)%10)
print(sum(ans)+stack-m)

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

using namespace std;

int main() {
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector < long long > vt(n);
    long long ans = 0;
    for(int i = 0; i < n ; ++i) {
        cin >> vt[i];
        ans ^= vt[i];
    }
    for(int i = 0 ; i < n ; ++i) {
        cout << (ans ^ vt[i]) << ' ';
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 4724
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
const int inf = 1001001000;
const long long int Inf = 1001001001001001000;

void print(vector<vector<int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}


int main(){
	int q;
	cin >> q;
	deque<int> que;
	rep(qi, q)
	{
		int i;
		cin >> i;
		if (i == 0){
			int d,x;
			cin >> d >> x;
			if (d == 0)	que.push_front(x);
			else que.push_back(x);
		}
		else if (i == 1)
		{
			int p;
			cin >> p;
			cout << que[p] << endl;
		}
		else
		{
			int d;
			cin >> d;
			if (d == 0)	que.pop_front();
			else que.pop_back();
		}
	}

	return 0;
}




Measured memory_bytes: 4564
#include <bits/stdc++.h>
#define len(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define chmax(x, v) x = max((x), (v))
#define chmin(x, v) x = min((x), (v))
typedef long long int lli;

#define rep(i,a,b) for(int i=a;i<b;i++)

#define endl "\n"
using namespace std;
using ll = long long;

int notSame(string temp,string t)
{
    int ans=0;
    rep(i,0,temp.size())
    {
        ans+=(temp[i]!=t[i]);
    }
    return ans;
}

int main()
{
    string s,t;
    cin>>s>>t;
    int ans=1e9;
    rep(i,0,(s.size()-t.size()+1))
    {
      string temp=s.substr(i,t.size());
      ans=min(ans,notSame(temp,t));
    }
    cout<<ans<<endl;
    return 0;


}

Measured memory_bytes: 3632
#include <stdio.h>
typedef long long ll;
int main(){
  ll k, c=7;
  scanf("%lld", &k);
  for(int i=1; i<=k; i++){
    c %= k;
    if(c==0){ printf("%d\n", i); return 0; }
    c = 10*c + 7;
  }
  printf("-1\n");
  return 0;
}

Measured memory_bytes: 1696
N,K = map(int, input().split())
p = []
for s in range(1,N+1):
    p.append(s)
for i in range(K):
    d = int(input())
    A = [int(x) for x in input().split()]
    B = len(A)
    for i in range(B):
        if A[i] in p:
            p.remove(A[i])
ans = len(p)
print(ans)

Measured memory_bytes: 9108
A, B, C, K = map(int, input().split())


def f(A, B, C, K) :
    
    sum = 0

    if K - A >= 0 :
        K = K - A
        sum = sum + (1 * A)
    else :
        sum = sum + (1 * K)
        K = 0

    if K <= 0 :
       return sum

    if K - B >= 0 :
        K = K - B
        sum = sum + (0 * B)
    else :
        sum = sum + (0 * K)
        K = 0

    if K <= 0 :
       return sum

    if K - C >= 0 :
        K = K - C
        sum = sum + (-1 * C)
    else :
        sum = sum + (-1 * K)
        K = 0

    if K <= 0 :
       return sum


print(f(A, B, C, K))


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


int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  int N; cin >> N;
  int lim = 1e5;
  vector<int> vec(lim);
  for (int i = 0; i < N; i++) {
    int a; cin >> a;
    vec.at(a)++;
  }
  int vmax = 0;
  for (int i = 0; i < lim; i++) {
    int s = vec.at(i);
    if (i-1 >= 0)  s += vec.at(i-1);
    if (i+1 < lim) s += vec.at(i+1);
    vmax = max(vmax, s);
  }
  cout << vmax << endl;

  return 0;
}



Measured memory_bytes: 640
#include<stdio.h>
int main()
{
	int n;
	scanf("%d",&n);
	int mx=1;
	while(mx<=n)
	{
		mx<<=1;
	}
	mx>>=1;
	if(mx==n)
	{
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	printf("1 %d\n",n+2);
	int m=n;
	if(!(n&1))
	{
		m--;
	}
	for(int i=2;i<=m;i++)
	{
		printf("%d %d\n",i,n+1);
		printf("%d %d\n",n+i,i^1);
	}
	if(!(n&1))
	{
		printf("%d %d\n",n,mx);
		printf("%d %d\n",n+n,n^mx^1);
	}
	return 0;
}

Measured memory_bytes: 2688
#include<bits/stdc++.h>
using namespace std;
#define reg register
#define Rint register int
#define FOR(i,a,b) for(register int i=(a),ed_##i=(b);i<=ed_##i;++i)
#define ROF(i,a,b) for(register int i=(a),ed_##i=(b);i>=ed_##i;--i)
typedef long long LL;
inline int read(){
	reg int ans=0,f=1; reg char c=getchar();
	while(!isdigit(c)) f^=(c=='-'), c=getchar();
	for(;isdigit(c);c=getchar()) ans=(ans<<1)+(ans<<3)+(c^48);
	return f?ans:-ans;
}
const int mod = 1000000007;
inline void inc(int &x,const int &y){ x+=y; if(x>=mod) x-=mod; }
inline int _abs(const int &x){ return x >> 31 ? -x : x; }
inline int _max(const int &x, const int &y){ return x < y ? y : x; }
inline int _min(const int &x, const int &y){ return x > y ? y : x; }
#define abs(x) _abs(x)
#define max(x, y) _max(x, y)
#define min(x, y) _min(x, y)
const int N = 55;
int n;
int f[N][N], C[N][N];

int main(){
	n = read();
	FOR(i, 0, n){
		C[i][0] = C[i][i] = 1;
		FOR(j, 1, i - 1) inc(C[i][j], C[i - 1][j - 1] + C[i - 1][j]);
	}
	f[1][0] = f[1][1] = n;
	FOR(i, 1, n - 1) FOR(j, 0, i){
		FOR(x, 1, n - i){
			if(x < j || (x ^ j) & 1) continue;
			FOR(y, 0, x){
				Rint tr = abs(y - ((x + j) >> 1));
				inc(f[i + x][tr], 1ll * f[i][j] * C[n - i][x] % mod * C[x][y] % mod);
			}
		}
	}
	printf("%d\n", f[n][0]);
	return 0;
}

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

int main() {
	char obj;
	bool flag = false;
	string vow = "aiueo";
	cin >> obj;
	
	rep (i, vow.size()) {
		if (obj == vow.at(i)) {
			flag = true;
		}
	}
	if (flag == true) {
		cout << "vowel" << endl;
	} else {
		cout << "consonant" << endl;
	}
	return 0;
}


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

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

    int T[N],X[N],Y[N];
    T[0]=0; X[0]=0; Y[0]=0;
    for(int i=1; i<=N; i++){
        cin >> T[i] >> X[i] >> Y[i];
    }

    for(int i=0; i<N; i++){
        int distance=abs(X[i+1]-X[i])+abs(Y[i+1]-Y[i]);
        if(((T[i+1]-T[i])<distance) or (distance+T[i+1]-T[i])%2==1){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

}

Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cstring>
#include <string>
#include <stack>
#include <tuple>
#include <queue>

using namespace std;
typedef long long ll;
ll MOD = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    bool C, F;
    C = F = false;
    int cnt = 0;
    for (auto& c : s)
    {
        cnt++;
        if (c == 'C')
        {
            C = true;
            break;
        }
    }
    int cnt2 = 0;
    for (auto& c : s)
    {
        cnt2++;
        if (c == 'F' && cnt2 >= cnt) F = true;
    }
    if (C && F) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
n,m = map(int,input().split())
ans = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  a-=1;b-=1
  ans[a] +=1
  ans[b] +=1
for i in range(n):
  if ans[i]%2 ==1:
    print("NO")
    exit()
print("YES")

Measured memory_bytes: 44760
#include "bits/stdc++.h"
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;

int main(){
  string S,T;
  cin>>S>>T;
  ll sz = S.size();
  ll tz = T.size();
  vector<string> ans;


  if(sz<tz){
       cout<<"UNRESTORABLE"<<endl;
    return 0;
  }

ll bar =0;
  for(ll i = sz-tz;i>=0;i--){
    bar=0;
    for(ll j=0;j<=tz;j++){
      if(tz==j){
        bar=1;
      }
      if(S[j+i]==T[j]||S[j+i]=='?'){
           continue;
      }
      else
      {
        break;
      }
      
    }

    
    if(bar==1){
      string s = S;
      for(ll j=0;j<tz;j++){
        s[i+j]=T[j];
      }
      for(ll i=0;i<S.size();i++){
      if(s[i]=='?')
      s[i]='a';
      }
      ans.push_back(s);
    break;
    }
  }

  if(ans.size()){
    sort(ALL(ans));


cout<<ans[0]<<endl;
  }
  else{
    cout<<"UNRESTORABLE"<<endl;
  }



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define per(i,n) for(int i=(n)-1; i>=0; i--)
#define chmin(a,b) a = min(a,b)
#define chmax(a,b) a = max(a,b)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vv = vector<vi>;
const int MOD = 1000000007;

int main(){
    int H,W,A,B; cin>>H>>W>>A>>B;
    
    rep(i,H){
        rep(j,W){
            cout << (((i<B)^(j<A))?1:0);
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 3612
s = input()
t = input()
s_length = len(s)
t_length = len(t)

count = []
for idx in range(s_length - t_length + 1):
    cnt = 0
    substr = s[idx: idx + t_length]
    for j in range(t_length):
        if substr[j] != t[j]:
            cnt += 1
    count.append(cnt)

print(min(count))


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

int main() {
  int A, B, C, D, L, R;
  cin >> A;
  cin >> B;
  cin >> C;
  cin >> D;
  L = A + B;
  R = C + D;
  if (L > R) {
    cout << "Left" << endl;
  }
  else if (L < R) {
    cout << "Right" << endl;
  }
  else {
    cout << "Balanced" << endl;
  }
}


Measured memory_bytes: 256
// input! macro is published in the following URLs.
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
// https://github.com/tanakh/competitive-rs.git
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        a: usize,
        _b: usize,
        s: chars,
    }
    let mut s = s;
    if s[a] != '-' {
        println!("No");
        return;
    }
    s.remove(a);
    if s.iter().any(|c| c.to_string().parse::<i64>().is_err()) {
        println!("No");
    } else {
        println!("Yes");
    }
}


Measured memory_bytes: 4352
import java.util.*;
public class Main { 
	static ArrayList<Integer> list = new ArrayList<Integer>();
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		makeList();
		while(true) {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			int c = stdIn.nextInt();
			if(a == 0 && b == 0 && c == 0) break;
			double cs = (double)b/(double)c;
			int max = 0;
			int ma = 0;
			int mb = 0;
			for(int i = 0; i < list.size(); i++) {
				if(list.get(i)> a) break;
				for(int j = 0; j < list.size(); j++) {
					int as = list.get(i);
					int bs = list.get(j);
					if(as * bs > a) break;
					double xs = (double)as/(double)bs;
					if(cs <= xs && xs <= 1 && as * bs > max) {
						max = as*bs;
						ma = as;
						mb = bs;
					}
				}
			}
			System.out.println(ma + " " + mb);
		}
	}
	static void makeList() {
		boolean[] isPrime = new boolean[1000000];
		Arrays.fill(isPrime, true);
		for(int i = 2; i < 100000; i++) {
			if(isPrime[i]) {
				for(int j = i + i; j < 1000000; j += i) {
					isPrime[j] = false;
				}
				list.add(i);
			}
		}
	}
}

	

Measured memory_bytes: 29348
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <utility>
#include <string>

using namespace std;

int main()
{
  string S, T;
  getline(cin, S);
  getline(cin, T);
  int count = 0;
  for (int i = 0; i < 3; ++i) {
    if (S[i] == T[i]) ++count;
  }
  cout << count;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <complex>
#include <numeric>
#include <string.h>
#include <random>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
double PI = 3.141592653589793238462643383279;
const double EPS = 1e-9;
const ll MOD = 998244353;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

int N;
int P[200], Q[200];
bool saw[200];
vector<pl> v;

ll gcd (ll x, ll y) {
    if (y == 0) return x;
    return gcd(y, x%y);
}

int main() {
    cin >> N;
    rep(i,N) cin >> P[i];
    rep(i,N) cin >> Q[i];
    rep(i,N) {
        P[i]--;
        Q[i]--;
    }
    {
        bool zero = true;
        rep(i,N) {
            if (P[i] != i) {
                zero = false;
            }
        }
        if (zero) {
            cout << 0 << endl;
            return 0;
        }
    }
    rep(i,N) P[i] = Q[P[i]];
    rep(i,N) {
        if (saw[i]) continue;
        ll a = 1;
        vector<int> tmp;
        {
            tmp.push_back(P[i]);
            int pos = Q[P[i]];
            while (pos != P[i]) {
                tmp.push_back(pos);
                pos = Q[pos];
                a++;
            }
        }
        //rep(j,tmp.size()) saw[tmp[j]] = true;
        ll b = -1;
        rep(j,tmp.size()) {
            if (tmp[j] == i) {
                b = j;
                break;
            }
        }
        if (b == -1) {
            cout << -1 << endl;
            return 0;
        }
        v.push_back(pl(a,b));
    }
    if (v.size() == 0) {
        cout << 0 << endl;
        return 0;
    }
    pl now = v[0];
    for (int i = 1; i < v.size(); i++) {
        ll t = now.second;
        ll l = now.first * v[i].first / gcd(now.first, v[i].first);
        ll cnt = 0;
        while (true) {
            if (t >= v[i].second && (t-v[i].second)%v[i].first == 0) {
                break;
            }
            t += now.first;
            cnt++;
            if (cnt > v[i].first) {
                cout << -1 << endl;
                return 0;
            }
        }
        now.first = l;
        now.second = t;
    }
    cout << now.second+1 << endl;
}


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

int main() {
  int N;
  cin >> N;
  string S;
  cin >> S;
  for(int i = 0; i< S.size();i++){
    int x = (((int) S.at(i)) + N);
    if(x >90){ x -= 26;}
  	S.at(i) = (char) x;
  }
  cout << S << endl;
}

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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;
const ll MOD = 1e9 + 7;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   ll n; cin >> n;
   int a[n];
   for(int i = 0; i <n; i++)
      cin >> a[i];
   int ans = 0;
   while(1)
   {
      for(int i = 0; i < n; i++)
      {
         if(a[i]%2)
         {
            cout << ans << nl;
            return 0;
         }
         a[i]/=2;
      }
      ans++;
   }
   return 0;
}


Measured memory_bytes: 3624
#include <iostream>
using namespace std;
int main(){
  string o,e;
  cin >> o >> e;
  int i;
  for(i=0;i<e.size();i++){
    cout << o[i] << e[i];
  }
  if(o.size()!=e.size()) cout << o[o.size()-1];
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 27 21:00:04 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

#N = int(input())
N,A,B = map(int,input().split())
#A = list(map(int,input().split()))


b = A + B - N if A + B - N >=0 else 0
ans = [str(min(A,B)),str(b)]

print(' '.join(ans))


Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val an = readLine()!!.split(" ").map(String::toInt)

    val fourTimes = an.count { it % 4 == 0 }
    val even = an.count { it % 2 == 0 }
    val num = if (fourTimes > 0) {
        n - 1
    } else {
        n
    }
    if (num <= fourTimes * 2 + ((even - fourTimes) / 2 * 2)) {
        println("Yes")
    } else {
        println("No")
    }
}




Measured memory_bytes: 51732
n,mat = raw_input(),[ map(int,raw_input().split()) for i in range(2)]
def f(mat,i,j):
	if i<0 or j <0:
		return -float('inf')
	if i == 0 and j == 0:
		return mat[i][j] 
	return mat[i][j] + max(f(mat,i-1,j),f(mat,i,j-1))
print f(mat,1,len(mat[0])-1)

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

int main() {
	string S, a = "CODEFESTIVAL2016";
	cin >> S;
	int ans = 0;
	for (int i = 0; i < 16; ++i) {
		if (S[i] != a[i]) ++ans;
	}
	cout << ans;
}

Measured memory_bytes: 256
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))
def f(x):
    return t - x*0.006

def abm(x):
    return abs(x-a)
h = list(map(f, h))
h = list(map(abm, h))
print(h.index(min(h))+1)

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

#define rep(i, n) for(int i = 0, i_length = (n); i < i_length; i++)
#define MOD 1000000007
#define ll long long

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

	bool ok = false;
	unordered_map<char, int> aaa;
	rep(i, n) aaa[s[i]]++;
	for (auto e : aaa) {
		if (e.second >= 2) ok = true;
	}

	if (ok) {
		ll minn = 1, maxx = n / 2 + 1;
		while (maxx - minn >= 2) {
			ll now = (minn + maxx) / 2;
			unordered_map<string, ll> sss;
			bool oknow = false;
			rep(i, n - now + 1) {
				string sub = s.substr(i, now);
				auto itr = sss.find(sub);

				if (itr == sss.end()) sss[s.substr(i, now)] = i;
				else {
					if (i - (*itr).second >= now) oknow = true;
				}
				if (oknow) break;
			}
			if (oknow) minn = now;
			else maxx = now;
		}

		cout << minn << endl;
	}
	else {
		cout << 0 << endl;
	}

	return 0;
}

Measured memory_bytes: 6668
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    s=input()
    s=list(s)
    n=len(s)
    s1=s[0:(n-1)//2]
    s2=s[(n+3)//2-1:]
    b1=s1[::-1]
    b2=s2[::-1]
    b=s[::-1]
#    print(s1,s2,b1,b2)
    if s1==b1 and s2==b2 and s==b:
        ans="Yes"
    else:
        ans="No"

    print(ans)

if __name__ == "__main__":

    main()

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
#define all(a) (a).begin(),(a).end()
typedef long long ll;
#define rep1(i,n) for(int i=1;i<=int(n);++i)
#define lb(s,x) (lower_bound(all(s),x)-s.begin())
#define ub(s,x) (upper_bound(all(s),x)-s.begin())
#define uniq(a) a.erase(unique(all(a)),a.end())
#define bit(k) (1LL<<(k))
const int INF = 1e9;

#define debug(x) cerr<<(#x)<<": "<<(x)<<endl
template<class T,class U>
ostream& operator<<(ostream& o, const pair<T,U> &p){
    o<<"("<<p.first<<", "<<p.second<<")";
    return o;
}
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }


typedef complex<double> Point;
typedef vector<Point> VP;
#define X real()
#define Y imag()
const double EPS = 1e-9;
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define ps_edge(PS,i) PS[i],PS[(i+1)%PS.size()]

namespace std {
    bool operator<(const Point a, const Point b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

double dot(Point a, Point b) {
    return a.X*b.X + a.Y*b.Y;
}

double cross(Point a, Point b) {
    return a.X*b.Y - a.Y*b.X;
}

int ccw(Point a, Point b, Point c) {
    b -= a;  c -= a;
    if (cross(b,c) >  EPS) return +1;  // counter clockwise
    if (cross(b,c) < -EPS) return -1;  // clockwise
    if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
    if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
    return 0;                          // a--c--b on line or a==c or b==c
}

// 点集合を含む最小の円の中心
Point minEnclosingCircle(const VP& ps) {
    Point c;
    double move = 0.5;
    rep(i,39) {  // 2^(-39-1) \approx 0.9e-12
        rep(t,70) {
            double max = 0;
            int k = 0;
            rep (j, ps.size()) if (max < norm(ps[j]-c)) {
                max = norm(ps[j]-c);
                k = j;
            }
            c += (ps[k]-c) * move;
        }
        move /= 2;
    }
    return c;
}


int main(void){
    int n;
    cin >> n;
    VP ps(n);
    rep(i,n){
        double x, y;
        cin >> x >> y;
        ps[i] = Point(x,y);
    }
    Point c = minEnclosingCircle(ps);
    double r = 0;
    rep(i,n){
        r = max(r, abs(c-ps[i]));
    }
    printf("%.20f\n",r);
    return 0;
}


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

long long f[25000001];
long long MOD = 1000000007;

long long Power(long long a, long long k)
{
	long long R = 1, ss = a, t = 1;
	while (k > 0)
	{
		if (k % (2 * t) != 0)
		{
			k -= t;
			R *= ss;
			R %= MOD;
		}
		t *= 2;
		ss *= ss;
		ss %= MOD;
	}
	return R;
}

int main()
{
	ios::sync_with_stdio(false);
	long long r = 0, K = 0, S, s = 0, l, d;
	cin >> S;
	long long I = floor(S / 8);
	for (long long i = 1; i <= 25000000; i++)
	{
		d = log10(i) + 1;
		f[i] = d;
	}
	for (int i = 1; i < 10000000; i++)
	{
		while (s < S)
		{
			r++;
			s += f[r];
		}
		if (s == S)
		{
			K++;
		}
		s -= f[i];
	}
	K += I;
	for (int i = 1; i <= I; i++)
	{
		if (S % i == 0)
		{
			d = S / i;
			long long p = Power(10, d) - Power(10, d - 1) - S / d;
			while (p < 0)
			{
				p += MOD;
			}
			K += p;
			K %= MOD;
		}
	}
	cout << K << endl;

	return 0;
}

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

int main(){
	int n,l;
	cin >> n >> l;
	int sum = 0;
	REP(i,n){
		sum += l + i -1;
	}
	int m = 100000;
	REP(i,n){
		if(abs(m) > abs(l+i-1)){
			m = l + i -1;
		}
	}
	cout << sum - m << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <string>
using namespace std;

const int qq = 1e2 + 10;
int num[qq];
int n, m, k;
char a[qq][qq], b[qq][qq];
bool judge(int x, int y){
	for(int i = x - m + 1, c = 1; i <= x; ++i, c++)
		for(int j = y - m + 1, d = 1; j <= y; ++j, d++)
			if(a[i][j] != b[c][d])	return false;
	return true;
}

int main(){
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i)
		scanf("%s", a[i] + 1);
	for(int i = 1; i <= m; ++i)
		scanf("%s", b[i] + 1);
	for(int i = m; i <= n; ++i){
		for(int j = m; j <= n; ++j)
			if(judge(i, j)){
				puts("Yes");
				return 0;
			}
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
N, M, C = map(int,input().split())

B = list(map(int,input().split()))

A = [list(map(int,input().split())) for i in range(N)]

ans = int(0)
a = int(0)
for i in range(N):
    a = int(0)
    for j in range(M):
            a += A[i][j]*B[j]
            if a > -C and j == M-1:
                    ans += 1
print(ans)

Measured memory_bytes: 3064
fun <T> readList(del:String = " ",f:String.()->T) = readLine()!!.split(del).map {f(it)}

fun main() {
	var (n,k) = readList {toLong()}
	val a = readList {toInt()-1}
	val c = Array(a.size) {-1}

	var i = 0
	var t = 0
	while(k>=0) {
		if(c[i]>=0)
			k %= t-c[i]

		if(k==0L) {
			println(i+1)
			return
		}
		--k
		c[i] = t++
		i = a[i]
	}
}


Measured memory_bytes: 64040
#include<bits/stdc++.h>
using namespace std;
int main()
{ 
  int n;
  cin>>n;
  if(n==25)
  cout<<"Christmas"<<endl;
  else if(n==24)
  cout<<"Christmas Eve"<<endl;
  else if(n==23)
  cout<<"Christmas Eve Eve"<<endl;
  else if(n==22)
  cout<<"Christmas Eve Eve Eve"<<endl;
  
  
}


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

constexpr int max_h = 100, max_w = 100, inf = 1e9;

struct Edge
{
    int dest, id, side;
    // weights[id][side] its weight of the edge
};

int h, w, s, t;
bool visited[max_h + max_w + 2];
string pond[max_h];
vector< array< int, 2 > > weights;
vector< Edge > graph[max_h + max_w + 2];

void add_edge(const int p, const int q, const int weight = 1, const bool directed = false)
{
    graph[p].push_back({q, (int)weights.size(), 0});
    graph[q].push_back({p, (int)weights.size(), 1});
    weights.push_back({weight, directed? 0 : weight});
}

vector< Edge > path;

int dfs(const int v, const int amount = inf)
{
    visited[v] = true;
    if (v == t)
        return amount;
    for (const auto& edge : graph[v])
        if (not visited[edge.dest] and weights[edge.id][edge.side])
        {
            path.push_back(edge);
            int returned_amount = 0;
            if ((returned_amount = dfs(edge.dest, min(amount, weights[edge.id][edge.side]))))
                return returned_amount;
            path.pop_back();
        }
    return 0;
}

int flow()
{
    int result = 0;
    int amount = 0;
    while ((amount = dfs(s)))
    {
        //cerr << "found flow: " << amount << '\n';
        for (const auto& edge : path)
        {
            //if (edge.dest == s)
            //    cerr << 's' << ' ';
            //if (edge.dest == t)
            //    cerr << 't' << ' ';
            //if (1 <= edge.dest and edge.dest <= h)
            //    cerr << "row: " << edge.dest - 1 << ' ';
            //if (h + 1 <= edge.dest and edge.dest <= h + w)
            //    cerr << "column: " << edge.dest - h - 1 << ' ';
            weights[edge.id][edge.side] -= amount;
            weights[edge.id][1 - edge.side] += amount;
        }
        //cerr << '\n';
        result += amount;
        path.clear();
        for (int i = 0; i < h + w + 2; ++i)
            visited[i] = false;
    }
    return result;
}

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

    cin >> h >> w;
    s = 0; t = h + w + 1;

    for (int i = 0; i < h; ++i)
        cin >> pond[i];

    for (int i = 0; i < h; ++i)
        for (int j = 0; j < w; ++j)
        {
            if (pond[i][j] == 'S')
            {
                add_edge(s, 1 + i, inf, true);
                add_edge(s, 1 + h + j, inf, true);
            }
            if (pond[i][j] == 'T')
            {
                add_edge(1 + i, t, inf, true);
                add_edge(1 + h + j, t, inf, true);
            }
            if (pond[i][j] == 'o')
                add_edge(1 + i, 1 + h + j);
        }

    int result = flow();
    cout << (result >= inf? -1 : result) << '\n';
}


Measured memory_bytes: 3908
#include <iostream>

using namespace std;

string a,b,ans;

int n;

int main()
{
    int i;
    cin>>n;
    cin>>a>>b;
    for(i=0;i<n;i++)
        ans+=a[i],ans+=b[i];
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
  {
  int N;
  cin>>N;
  int a[N];
  if(N>=1 && N <=1000)
    {
    
    for(int i=0;i<N;i++)
      cin>>a[i];
       
    }
  bool flag=false;
  for(int i=0;i<N;i++)
    { 
    if(a[i]<=1000 && a[i]>=1)
      {
    
if((a[i]%3!=0) && (a[i]%5!=0)&& a[i]%2==0)
         { 
           
      
      flag=true;
          }
      }
    }
    if(flag)
        cout<<"DENIED";
        else
         cout<<"APPROVED";
  }
          

Measured memory_bytes: 256