akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
	Scanner cin = new Scanner(System.in);
	while(true){
		if(!cin.hasNext()){
			break;
		}
		double x,ans;
		x=cin.nextDouble();
		ans=x;
		for(int i=2;i<11;i++){
			if(i%2==0){
				x=x*2;
				ans=ans+x;
			}
			else{
				x=x/3;
				ans=ans+x;
			}
		}
		System.out.println(ans);
	}
	}

}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S; cin >> S;
    int ans=0;
    for (int i=0;i<S.size();++i){
        if (S[i]=='*'){
            cout << ans << '\n';
            return 0;
        }
        if (S[i]=='(') ++ans;
        if (S[i]==')') --ans;
    }
    cout << ans << '\n';
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  string a;
  cin>>a;
  int b=0;
  bool c=false;
  rep(i,a.size()){
    rep(j,a.size()){
    if(a.at(i)==a.at(j))
      b++;
      }
    if(b%2==1){
      c=true;
    break;
      }
}    
  if(c)
    cout<<"No";
  else
    cout<<"Yes";
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<unordered_map>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#define FOR(i, a, b) for(int i = (a);i < (b);++i)
#define FORR(i, b, a) for (int i = (b) - 1;i >= 0;--i)
#define REP(i, n) for(int i = 0;i < (n);++i)
#define REPR(i, n) for(int i = (n) - 1;i >= 0;--i)
#define ITER(itr, v) for(auto itr = v.begin();itr != v.end();++itr)
#define SORT(v) sort(v.begin(), v.end())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;


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

	int N;
	cin >> N;
	vector<int> A(N + 1);
	vector<vector<int>> x(N + 1), y(N + 1);
	FOR(i, 1, N + 1) {
		cin >> A[i];
		x[i].resize(A[i]);
		y[i].resize(A[i]);
		REP(j, A[i]) {
			cin >> x[i][j] >> y[i][j];
		}
	}
	int res = 0;
	for (int bit = 1;bit < 1 << N;++bit) {
		int num = 0;
		vector<int> T(N + 1);
		REP(i, N) {
			if (bit >> i & 1) {
				T[i + 1] = 1;
			}
		}
		
		FOR(i, 1, N + 1) {
			bool ok = true;
			if (T[i]) {
				REP(j, A[i]) {
					if (y[i][j] && !T[x[i][j]]) {
						ok = false;
						break;
					}
					else if (!y[i][j] && T[x[i][j]]) {
						ok = false;
						break;
					}
				}
				if (!ok) {
					num = 0;
					break;
				}
				++num;
			}
		}
		res = max(res, num);
	}
	cout << res << endl;

	return 0;
}

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

void SieveOfEratosthenes(int n)
{
    int c = 0;
    bool prime[n+1];
    memset(prime, true, sizeof(prime));

    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }

    for (int p=2; p<=n; p++)
       if (prime[p]){
            c++;
       }

       cout<<c<<endl;

}

// Driver Program to test above function
int main()
{
    int n;
    while(cin>>n)
    {
        SieveOfEratosthenes(n);
    }

    return 0;
}

Measured memory_bytes: 4048
N = int(input())
m = 0
a = 0
r = 0
c = 0
h = 0

for i in range(N):
    S = input()
    if S[0] == 'M':
        m += 1
    elif S[0] == 'A':
        a += 1
    elif S[0] == 'R':
        r += 1
    elif S[0] == 'C':
        c += 1
    elif S[0] == 'H':
        h += 1

ans = m * a * (r+c+h) + m * r * (c+h) + m * c * h + a * r * (c + h) + a * c * h + r * c * h
print(ans)

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


int main()
{
	int H,W;
	cin>>H>>W;
	vector<string> a(H);
	rep(i,H) cin>>a[i];

	rep(i,H)
	{
		bool flag=true;
		rep(j,W)
		{
			if(a[i][j]=='#') flag=false;
		}
		if(flag)
		{
			rep(j,W)
			{
				a[i][j]='\0';
			}
		}
	}

	rep(j,W)
	{
		bool flag=true;
		rep(i,H)
		{
			if(a[i][j]=='#') flag=false;
		}
		if(flag)
		{
			rep(i,H)
			{
				a[i][j]='\0';
			}
		}
	}
	rep(i,H)
	{
		bool flag=true;
		rep(j,W)
		{
			if(a[i][j]!='\0')
			{
				flag=false;
				cout<<a[i][j];
			}
		}
		if(!flag) cout<<endl;
	}
	return 0;
}


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

int main(void) {
    int64_t N;
    int64_t tempa;
    int64_t sum;
    unordered_map<int64_t,int64_t> A;

    cin >> N;
    for(int i=0;i<N;i++) {
        cin >> tempa;
        A[tempa]++;
    }

    sum = 0;
    for(auto it:A) {
        if(it.second % 2) {
            sum++;
        }
    }

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


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

int main()
{
    int N; string S;
    cin >> N >> S;
    if(N%2 != 0){
        cout << "No" << endl;
        return 0;
    } else {
        int m = N/2;
        for(int i=0; i<m; i++){
            if(S[i] != S[i+m]){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sc scanf
#define pf printf
#define ll long long
const ll M= 1000000007;
bool isp(int x)
{
    for(int i=2;i*i<=x;i++)
    {
        if(x%i==0)
            return 0;
    }
    return 1;

}
int main()
{
    ll i,j,k,l=1,p,n;
    sc("%lld",&n);
    for(i=2;i<=n;i++)
    {
      if(isp(i))
      {
          p=i;
          long long c=1;
          while(n/p)
          {
              c=c+n/p;
              p=p*i;
          }


          //pf("%d=%d\n",i,c);
          l=l*c;
          //pf("l==%d\n",l);
          l%=M;
      }

    }
    pf("%lld\n",l);
}


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

int main(){
	int n, a[12], b[12], in, sum, kaisu;
	while(cin >> n){
		if (n == 0) { break; }
		for(int i = 0;i<12;i++){
			if (i < n) { cin >> a[i]; }
			else { a[i] = 0; }
		}
		kaisu = 0;
		while(true){
			sum = 0;
			for(int i = 0;i<n;i++){
				b[i] = 0;
				for(int j = 0;j<n;j++){
					if (a[i] == a[j]) { b[i]++; }
				}
				if (a[i] == b[i]) { sum++; }
			}
			for(int i = 0;i<n;i++){
				a[i] = b[i];
			}
			if (sum == n) { break; }
			kaisu++;
		}
		cout << kaisu << endl
			<< a[0];
		for(int i = 1;i<n;i++){
			cout << " " << a[i];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3020
#include <bits/stdc++.h>
#define REP(i, s, n) for (int i = s; i < (int)(n); i++)
#define ALL(a) a.begin(), a.end()
#define MOD 1000000007
using namespace std;
using ll = long long;

template <typename T>
class SegmentTree {
   public:
    SegmentTree(vector<T> &base, function<T(T, T)> fn_, T e_) {
        fn = fn_;
        e = e_;
        n = 1;
        while (n < (int)base.size()) n *= 2;

        node.resize(2 * n - 1, e);
        REP(i, 0, base.size())
        node[n - 1 + i] = base[i];
        for (int i = n - 2; i >= 0; i--) node[i] = fn(node[2 * i + 1], node[2 * i + 2]);
    }

    // 0-origin
    void update(int i, T x) {
        i += n - 1;
        node[i] = x; // for update
        // node[i] += x // for addition
        while (i > 0) {
            i = (i - 1) / 2;
            node[i] = fn(node[2 * i + 1], node[2 * i + 2]);
        }
    }

    // 0-origin, [a, b)
    T query(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return e;
        if (a <= l && r <= b) return node[k];

        T vl = query(a, b, 2 * k + 1, l, (l + r) / 2);
        T vr = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return fn(vl, vr);
    }

    void print(int w = 4) {
        int prev = 0;
        for (int i = 1; i <= n; i *= 2) {
            for (int j = prev; j < prev + i; j++) {
                cout << setw(n * w / i) << setfill(' ') << node[j];
            }
            cout << endl;
            prev += i;
        }
    }

   private:
    int n;
    vector<T> node;
    function<T(T, T)> fn;
    T e;
};

int main() {
    int N, M; string S; cin >> N >> M >> S;

    vector<int> base(N + 1, 1 << 29);
    base[N] = 0;
    auto fn = [](auto l, auto r){ return min(l, r); };
    SegmentTree<int> seg(base, fn, 1 << 29);

    for (int i = N - 1; i >= 0; i--) {
        if (S[i] == '1') continue;
        seg.update(i, seg.query(i + 1, min(i + M + 1, N + 1)) + 1);
    }

    int cnt = seg.query(0, 1), prev = 0;
    if (cnt == 1 << 29) {
        cout << -1 << endl;
        return 0;
    }

    REP(i, 1, N + 1) {
        int v = seg.query(i, i + 1);
        if (v != 1 << 29 && cnt != v) {
            cnt = v;
            cout << i - prev << endl;
            prev = i;
        }
    }

    return 0;
}

Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;

void print(const vector<int>& arr)
{
    cout << arr[0];
    for (size_t i = 1; i < arr.size(); i++) {
        cout << " " << arr[i];
    }
    cout << endl;
}

void insertion_sort(vector<int>& arr)
{
    for (size_t i = 1; i < arr.size(); i++) {
        int target = arr[i];
        ssize_t j = i - 1;

        while (j >= 0 && arr[j] > target) {
            arr[j + 1] = arr[j];
            j--;
        }

        arr[j + 1] = target;

        print(arr);
    }
}

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

    vector<int> arr(n);
    for (auto&& a : arr) {
        cin >> a;
    }

    print(arr);
    insertion_sort(arr);
}



Measured memory_bytes: 3100
N = int(input())
s = [input() for i in range(N)]
M = int(input())
t = [input() for i in range(M)]
st = list(set(s) | set(t))

ans = []
for i in st:
    tmp = 0
    tmp += s.count(i)
    tmp -= t.count(i)
    ans.append(tmp)
    
print(max(0, max(ans)))

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

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int x, y, z;
	cin >> x >> y >> z;
	
	int max = 0;
	for (int i = 0; ; i++) {
		int t = i * y + (i + 1) * z;
		if (t <= x) {
			max = i;
		} else {
			break;
		}
	}
	cout << max << endl;
}

Measured memory_bytes: 256
a = list(map(int,input().split()))

flag = False

if a[0] == a[1] and a[0] != a[2]:
    flag = True

if a[0] == a[2] and a[0] != a[1]:
    flag = True

if a[1] == a[2] and a[1] != a[0]:
    flag = True

if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#[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! {
        n: usize,
        s: String,
    }
    if n % 2 == 1 {
        println!("No");
        return
    }
    let s = s.chars().collect::<Vec<_>>();
    let d = n / 2;
    for i in 0..d {
        if s[i] != s[i +d] {
            println!("No");
            return
        }
    }
    println!("Yes");
}


Measured memory_bytes: 4352
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,M,*xy = map(int, read().split())

    check = [False] * N
    check[0] = True
    num = [1] * N

    for x, y in zip(*[iter(xy)]*2):
        num[x-1] -= 1
        num[y-1] += 1
        if check[x-1]:
            check[y-1] = True
        if num[x-1] == 0:
            check[x-1] = False

    ans = sum(check)
    print(ans)


if __name__ == "__main__":
    main()


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

namespace ConsoleApp1
{
    public class P
    {
        public int area { get; set; }
        public int id { get; set; }
    }

    public class Hello
    {
        public static void Main()
        {
            var s = Console.ReadLine().Trim();
            Ans(s);
        }
        public static void print(Stack<P> st)
        {
            var n = st.Count();
            if (n == 0) { Console.WriteLine(0); Console.WriteLine(0); return; }
            var a = new int[n];
            var asum = 0;
            for (int i = n - 1; i >= 0; i--)
            {
                var w = st.Pop();
                a[i] = w.area;
                asum += w.area;
            }
            Console.WriteLine(asum);
            Console.Write("{0} ", n);
            for (int i = 0; i < n; i++)
                if (i == n - 1) Console.WriteLine(a[i]);
                else Console.Write("{0} ", a[i]);

        }
        public static void Ans(string s)
        {
            var st1 = new Stack<int>();
            var st2 = new Stack<P>();
            for (int i = 0; i < s.Length; i++)
                if (s[i] == '\\') st1.Push(i);
                else if (s[i] == '/' && st1.Count() > 0)
                {
                    var id = st1.Pop();
                    var area = i - id;
                    while (st2.Count() > 0 && id <= st2.Peek().id)
                    {
                        area += st2.Peek().area;
                        st2.Pop();
                    }
                    st2.Push(new P { id = id, area = area });
                }
            print(st2);
        }
    }
}





Measured memory_bytes: 20636
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
If I'm the sun, you're the moon
Because when I go up, you go down
*******************************
I'm working for the day I will surpass you
https://www.a2oj.com/Ladder16.html
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         long N = Long.parseLong(st.nextToken());
         long A = Long.parseLong(st.nextToken());
         long B = Long.parseLong(st.nextToken());
         long res = A*(N/(A+B));
         long boof = N%(A+B);
         res += Math.min(boof, A);
         System.out.println(res);
      }
   }

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
//	Table is the complete reverse of dp
//	Always think of the pattern (LCM, GCD)
//	Be careful of unsigned
//	double epsilon = FLT_EPSILON;
//	Think of a solution that gets TLE and optimize it

int main()
{
    cin.tie(nullptr); ios_base::sync_with_stdio(false);
    int x;
    cin >> x;
    if(x < 600)
    	cout << 8;
    else if(x < 800)
    	cout << 7;
    else if(x < 1000)
    	cout << 6;
    else if(x < 1200)
    	cout << 5;
    else if(x < 1400)
    	cout << 4;
    else if(x < 1600)
    	cout << 3;
    else if(x < 1800)
    	cout << 2;
    else
    	cout << 1;
}


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

using namespace std;
const int mod = 1000000007;

int main(){
    string S;
    cin >> S;
    if(S == "Sunny"){
        cout << "Cloudy" << endl;
    }else if(S == "Cloudy"){
        cout << "Rainy" << endl;
    }else{
        cout << "Sunny" << endl;
    }
}

Measured memory_bytes: 256
n,d=map(int,input().split())
x=[list(map(int,input().split())) for _ in range(n)]
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        dist=sum( (x[i][k]-x[j][k])**2 for k in range(d) )**0.5
        if dist%1==0: ans+=1
print(ans)

Measured memory_bytes: 38640
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>

#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <functional>

#include <sstream>
#include <iostream>

using namespace std;
typedef long long llint;
const llint inf = 1000000000000000000LL;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

#define TRACE(x) cerr << #x << " = " << x << endl
#define _ << " _ " <<

const int MAXN = 1e5 + 5;

int N;
int dep[MAXN];
int dad[MAXN];
int cnt[MAXN];
vector<int> T[MAXN];

void dfs(int i, int cdep = 1) {
  dep[i] = cdep;
  cnt[i] = 1;

  for (int j : T[i]) {
    if (j == dad[i]) continue;
    dad[j] = i;
    dfs(j, cdep + 1);
    cnt[i] += cnt[j];
  }
}

int main(void) 
{
  scanf("%d", &N);
  REP(i, N - 1) {
    int a, b;
    scanf("%d%d", &a, &b);
    T[a].push_back(b);
    T[b].push_back(a);
  }

  dfs(1);

  int i = N, k = dep[N] / 2 - 1;
  while (k > 0) {
    i = dad[i];
    --k;
  }

  if (cnt[i] >= N - cnt[i])
    puts("Snuke");
  else
    puts("Fennec");
  
  return 0;
}


Measured memory_bytes: 13184
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>

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

using namespace std;
using ll = long long;

int main() {
	int N, M;
	cin >> N >> M;
	priority_queue<int> que;

	rep(i, N)
	{
		int work;
		cin >> work;
		que.push(work);
	}

	rep(i, M)
	{
		que.push(que.top() / 2);
		que.pop();
	}

	ll ans = 0;

	rep(i, N)
	{
		ans += que.top();
		que.pop();
	}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b; cin>>a>>b;
	if ((a*b)%2==0) cout<<"Even\n";
	else cout<<"Odd\n";
	return 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			long n = sc.nextInt();
			long k = sc.nextInt();

			long result = 0;
			for (int i = 0; i < n; i++) {
				int x = sc.nextInt();
				if (Math.abs(k - x) < x) {
					result += Math.abs(k - x) * 2;
				} else {
					result += x * 2;
				}
			}

				System.out.println(result);
		}
	}
}


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

int main(){
    long long N,K;
    cin >> N >> K;
    long long A1 = N%K;
    if(A1 <= K-A1){
        cout << A1 << endl;
    }
    else{
        cout << K-A1 << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


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

	int r;
	cin >> r;
	puts(r*r);
	
	return 0;
}

Measured memory_bytes: 256
<?php
  $N = (int)fgets(STDIN);
  $odd = false;
  $count = 0;
  $data = explode(" ",fgets(STDIN));
  while(true){
    for($i=0;$i<$N;$i++){
      if($data[$i] % 2 != 0){
        $odd = true;
      }
      $data[$i] = (int)($data[$i]/2);
    }
    if(!$odd){
      $count++;
    }else{
      break;
    }
  }
echo $count;

Measured memory_bytes: 3828
object Main extends App {
  val input = io.Source.stdin.getLines.toIndexedSeq.map(_.toInt)
  
  private def func():Int={
  	var i=1
    var next=1
    var visited=Set[Int]()
    while(!visited.contains(next)){
      visited = visited ++ Set(next)
      next=input(next)
      if(next == 2) return i      
      i += 1
    }
    -1
  }
  println(func())
}


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

int main(){
    //グラフの作成
    int N,M;cin>>N>>M;
    Graph G(N);
    rep(i,M){
        int a,b;cin>>a>>b;a--;b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    //スタートから何ステップで到達できるか
    vector<int>dist(N,-1);
    //発見済み訪問前の頂点を入れておく
    queue<int>que;
    //初期条件
    dist[0]=0;
    que.push(0);
    //頂点0が初期ノード
    //BFS
    vector<int>Ans(N);
    while(!que.empty()){
        int v=que.front(); que.pop();
        for(auto nv:G[v]){
            if(dist[nv]!=-1){
                continue;
            }//訪問済みなら無視
            Ans[nv]=v+1;
            dist[nv]=dist[v]+1;
            que.push(nv);
        }
    }
    cout<<"Yes"<<endl;
    for(int i=1;i<N;i++){
        cout<<Ans[i]<<endl;
    }
}

Measured memory_bytes: 10564
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
using namespace std;

int main(){
  int n,i,c,s;
  cin >> n;
  for(i=1;i<=n;i++){
    cout << "Case " << i << ':' << endl;
    cin >> s;
    c=10;
   while(c){
     s=s*s;
     s/=100;
     s%=10000;
     cout << s << endl;   
     c--;
   }
  }
  return 0;
}


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

const int MAXN = 200000+10;

int cnt[MAXN<<1];
int cover[MAXN<<1];
int Array[MAXN<<1];
int res=0;
int N,M;

void check(){
	cout<<"--------------------------------"<<endl;
	
	vector<int>  a(Array+1,Array+N+1);
	
	sort(a.begin(),a.end());
	
	cout<<"Array:\t";
	for(int i=1;i<=N;i++){
		printf("%4d",Array[i]);
	}
	cout<<endl;
	
	
	cout<<"sorted:\t";
	for(int i=1;i<=N;i++){
		printf("%4d",a[i-1]);
	}
	cout<<endl;
	
	
	cout<<"===="<<endl;
	
	cout<<"cover:\t";
	for(int i=1;i<=N;i++){
		printf("%3d:%d",i,cover[i]);
	}
	cout<<endl;
	
	cout<<"--------------------------------"<<endl;
}


int main(){
	res=0;
	scanf("%d%d",&N,&M);
	for(int i=1;i<=N;i++){
		scanf("%d",Array+i);
		cnt[Array[i]]++;
	}
	for(int i=N;i>0;i--){
		int j=cnt[i];
		while(j--){
			if(i>j)	cover[i-j]++;
		}
	}
	for(int i=1;i<=N;i++){
		res+=(cover[i]==0);
	}
	
	int X,Y;
	int num;
	//cout<<res<<endl;
	for(int i=0;i<M;i++){
		scanf("%d%d",&X,&Y);
		num=Array[X];
		Array[X]=Y;
		cnt[num]--;
		if(num-cnt[num]>0)	--cover[num-cnt[num]];
		if((num-cnt[num]>0)&&(0==cover[num-cnt[num]]))	res++;
		cnt[Y]++;
		if(Y-cnt[Y]+1>0)	++cover[Y-cnt[Y]+1];
		if((Y-cnt[Y]+1>0)&&(1==cover[Y-cnt[Y]+1]))	res--;
		printf("%d\n",res);
		//check();
	}
	return 0;
}

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

void Main()
{
    int n, k;
    cin >> n >> k;
    vector<int> c(n), p(n);
    long maxsum = -1e10;
    for (int i = 0; i < n; i++)
    {
        cin >> p[i];
        p[i]--;
    }
    for (int i = 0; i < n; i++)
    {
        cin >> c[i];
    }
    for (int i = 0; i < n; i++)
    {
        int pos = i;
        long step = 1;
        long sum = c[pos];
        maxsum = max(sum, maxsum);
        pos = p[pos];
        while(step < k && pos != i){
            sum += c[pos];
            maxsum = max(sum, maxsum);
            step++;
            pos = p[pos];
        }
        long len = step;
        long loopsum = sum;
        if(step < k){
            int nloop = (k-step)/len;
            nloop = max(0, nloop-1);
            sum += nloop * loopsum;
            maxsum = max(sum, maxsum);
            step += nloop * len;
        }
        while(step < k){
            sum += c[pos];
            maxsum = max(sum, maxsum);
            step++;
            pos = p[pos];
        }
    }
    cout << maxsum << endl;
}

int main(int argc, char **argv)
{
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    Main();
    return 0;
}


Measured memory_bytes: 3640
/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		
		Scanner sc = new Scanner(System.in);
		
		//int arr[] = {10,20,5,1,0,100,12,9,20,-100};
		int arr[] = new int[10];
		int i = 0;
		while( sc.hasNext() ){
    		String line[] = sc.nextLine().split(" ");
			arr[i] = Integer.parseInt(line[0]);
			i++;
		}
		
		Arrays.sort(arr);
    	
    	System.out.println(arr[9]);
    	System.out.println(arr[8]);
    	System.out.println(arr[7]);
	}
}

Measured memory_bytes: 17144
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    s += (s[n-1] == 's' ? "es" : "s");
    cout << s << '\n';
    return 0;
}

Measured memory_bytes: 3628
import bisect

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

ans = []

A = sorted(A)

if N == 2 :
    ans.append([A[1],A[0]])
    calc = A[1] - A[0]

else :
    ind = bisect.bisect_left(A,0)

    X = A[:ind]
    Y = A[ind:]
    
    if len(X) == 0 :
        ans.append([Y[0],Y[1]])
        X.append(Y.pop(0)-Y.pop(0))
    
    elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X.pop(-1)-X.pop(-1))
    
    while len(Y) != 1 :
        ans.append([X[-1],Y[0]])
        X[-1] -= Y.pop(0)
    
    while len(X) :
        ans.append([Y[0],X[-1]])
        Y[0] -= X.pop(-1)
    
    calc = Y.pop(0)

print(calc)
for a in ans :
    print(*a)


Measured memory_bytes: 22652
import sys
sys.setrecursionlimit(10 ** 5)

N, Z, W = map(int, input().split())
a = list(map(int, input().split()))
a.reverse()
a += [W] #最後にYさんの手札を加えておく
dp_T = [-1] * (N + 1) #Xの手番
dp_F = [-1] * (N + 1) #Yの手番

def calc(n, flag): #n: 残りの山の枚数　flag: ターンの管理
    #既に計算済みの場合その値を返す
    if flag == True and dp_T[n] != -1:
        return dp_T[n]
    if flag == False and dp_F[n] != -1:
        return dp_F[n]

    if n == 1: #山の残り枚数が1枚の時 -->引くしかなく得点が決定
        return abs(a[0] - a[n])
    if flag == True: #Xのターン-->大きくしたい
        tmp = 0
        for i in range(1, n + 1): #自分が引く枚数 = 1 ~ n枚
            if i == n: #残り枚数0で相手に渡す = 自分が最後の1枚を引く -->相手の手札が決まっているから得点が決定
                tmp = max(tmp, abs(a[0]-a[n]))
            else: #残り枚数が1枚以上ある時、手番は相手に変える
                tmp = max(tmp, calc(n-i, not flag))
        dp_T[n] = tmp
        return tmp
    if flag == False: #Yのターン-->小さくしたい
        tmp = 10 ** 10 #最大値
        for i in range(1, n + 1): #自分が引く枚数 = 1 ~ n枚
            if i == n - 1: #残り0枚で相手に渡す
                tmp = min(tmp, abs(a[0] - a[n]))
            else:
                tmp = min(tmp, calc(n-i, not flag))
        dp_F[n] = tmp
        return tmp

print (calc(N, True))


Measured memory_bytes: 4852
## coding: UTF-8
MAX = 10**7+10
#MAX = 101
fac = [0] * (MAX+1)

N = int(input())

for i in range(1, MAX):
    for j in range(1, MAX):
        try:
            fac[i*j] += 1
        except IndexError: #終了条件が難しいイテレータについて、リストの範囲外に出た瞬間にIndexErrorを検知してbreakする実装
            break

ans = [1]
for i in range(2, MAX):
    ans.append(ans[-1] + i * fac[i])

print(ans[N-1])
#print(ans[:10])
#print(fac[:100])







'''
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]

now = 1
ans = [1]

for i in range(2, 10**7+1):
    now += i * len(make_divisors(i))
    #print(make_divisors(i))
    ans.append(now)

print(ans[:10])
'''
'''
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    ret = 1
    for i in range(len(arr)):
        ret *= (arr[i][1] + 1)
    return ret

now = 1
ans = [1]

for i in range(2, 10**7+1):
    now += i * factorization(i)
    #print(i, factorization(i))
    ans.append(now)

print(len(ans))
'''

Measured memory_bytes: 355680
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define pll pair<long long,long long>
using namespace std;
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int x1,x2,x3,x4,x5;
    cin>>x1>>x2>>x3>>x4>>x5;
    if(x1==0)cout<<1;
    else if(x2==0)cout<<2;
    else if(x3==0)cout<<3;
    else if(x4==0)cout<<4;
    else if(x5==0)cout<<5;
    return 0;
}
    

Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <algorithm>
int main()
{
    std::string S;
    std::cin >> S;
    std::sort(std::begin(S), std::end(S));
    if (S[0] == S[1] && S[1] != S[2] && S[2] == S[3]) {
        std::cout << "Yes" << std::endl;
    }
    else {
        std::cout << "No" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
def main():
    a, b = map(int, input().split())
    # xorの累積を調べると周期性が4である余りをrとすると以下のようになる
    # r	累積XOR
    # 0	N 
    # 1	1 
    # 2	N+1
    # 3	0
    def cumxor(n):
        if n % 4 == 0:
            return n
        elif n % 4 == 1:
            return 1
        elif n % 4 == 2:
            return n+1
        else:
            return 0
    
    # aからbまでのxorはa-1までのxorと、bまでのxorになるので
    ans = cumxor(a-1) ^ cumxor(b)        
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#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(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  ll a,b,x;
  cin>>a>>b>>x;

  cout<<b/x-a/x+((a%x)? 0:1)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int dp[50];

int fib(int n)
{
    if (n == 0 || n == 1) return dp[n] = 1;
    if (dp[n] != -1) return dp[n];
    return dp[n] = fib(n - 1) + fib(n - 2);
}

int main(int argc, char const *argv[])
{
    int n, i;
    for (i = 0; i < 50; i++) {
        dp[i] = -1;
    }    
    scanf("%d", &n);
    printf("%d\n", fib(n));

    return 0;
}




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

int minCost( int a[], int n,int k){


    int dp[n]={0};

    dp[0]=0;

    for(int i=1;i<n;i++){
        dp[i]=INT_MAX;

        for(int j=1;j<=k;j++){
            if(i-j>=0)
            dp[i]=min(dp[i],dp[i-j]+abs(a[i]-a[i-j]));
        }

        

    }

    return dp[n-1];



}

int main() {
    int n,k;
    cin>>n>>k;
    int a[n];

    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    cout<<minCost(a,n,k);



}


Measured memory_bytes: 4404
#include<bits/stdc++.h>
using namespace std;
inline int read(){
    char ch=getchar();int w=1,c=0;
    while(!isdigit(ch)){if (ch=='-') w=-1;ch=getchar();}
    while(isdigit(ch)){c=(c<<1)+(c<<3)+(ch^48);ch=getchar();}
    return w*c;
}
map<int,int> mp;
long long m,n,ans;
long long a[500000],s[500000],ss[500000];
int main(){
	n=read(),m=read();
	for (int i=1;i<=n;i++)
	a[i]=read(),s[i]+=s[i-1]+a[i],ss[i]=s[i]%m;
	for (int i=n;i>0;i--)
	{
		ans+=mp[ss[i]]+(ss[i]==0),mp[ss[i]]++;
	}
	cout<<ans<<"\n";
	return 0;
}



Measured memory_bytes: 12160
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

int main()
{
    int n;
    string s1, s2;
    cin >> n >> s1 >> s2;
    int state[52];
    bool f = false;
    for(int i = 0; i < n; i++){
        if(s1[i] == s2[i]) state[i] = 0;
        else if(f){
            state[i] = 2;
            f = false;
        }
        else{
            state[i] = 1;
            f = true;
        }
    }
    ll ans;
    if(state[0] == 0) ans = 3;
    else ans = 6;
    for(int i = 1; i < n; i++){
        if(state[i] == 0){
            if(state[i - 1] == 0) ans = ans * 2 % MOD;
        }
        if(state[i] == 1){
            if(state[i - 1] == 0) ans = ans * 2 % MOD;
            else ans = ans * 3 % MOD;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,j;
    cin>>n;
    int a[n+2];
    for(i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int sum=0;
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            for(int k=j+1;k<n;k++)
            {
                if(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[k]+a[j]>a[i])
                {
                    if(a[i]!=a[j] && a[j]!=a[k] && a[i]!=a[k])
                        sum++;
                }
            }
        }
    }
    cout<<sum<<endl;
    return 0;
}



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

int main() {
  int N,K;
  cin >> N >> K;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    if (x >= K - x) {
      sum += 2 * (K - x);
    }
    else {
      sum += 2 * x;
    }
  }
  cout << sum;
}


Measured memory_bytes: 3472
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll; ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);
ll fac(ll x){if(x==0) return 1;  return x*fac(x-1);}

int main(){
    ll n,k; cin>>n>>k;
    vector<double>v(n);
    rep(i,n) cin>>v[i];
    vector<double>a(n);
    rep(i,n){
        a[i]=(v[i]+1)/2;
    }
    vector<double>ans(n+1,0);
    rep(i,n) ans[i+1]=ans[i]+a[i];
    double res=-1;
    for(int i=0;i<=n-k;i++){
        res=max(res,ans[i+k]-ans[i]);
    }
    cout<<fixed<<setprecision(8)<<res<<endl;
}

Measured memory_bytes: 4992
#include <stdio.h>

int main(){
	int i, j, n, cls;
	char mark, dummy;
	int A[4][13] = {};
	
	//while( scanf("%d", &n) != EOF)
	scanf("%d", &n);

	for(i=0; i<n; i++) {
		scanf("%c", &dummy);
		scanf("%c %d", &mark, &cls);
		if(cls > 0 && cls <= 13) {
			if (mark == 'S') A[0][cls-1] = 1;
			if (mark == 'H') A[1][cls-1] = 1;
			if (mark == 'C') A[2][cls-1] = 1;
			if (mark == 'D') A[3][cls-1] = 1;
		}
	}

	for(j=0; j<4; j++) {
		switch(j) {
			case 0: mark = 'S'; break;
			case 1: mark = 'H'; break;
			case 2: mark = 'C'; break;
			case 3: mark = 'D'; break;
		}
		for(i=0; i<13; i++) {
			if(A[j][i]==0) printf("%c %d\n", mark, i+1);
		}
	}

	return 0;
}

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

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

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

  int ans = 0;
  int now = 1;  
  for ( int i = 1; i < 100; i++ ) {
    if ( now >= b ) break;
    ans++;
    now += (a-1);    
  }

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


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MOD (ll)1000000007

int main(void)
{
	int n, b, c;
	scanf("%d", &n);
	int ans = 0;
	bool ok = false;

	for (int i = 1; i <= n; i++)
	{
		scanf("%d %d", &b, &c);
		if (b == c)
			ans++;
		else
			ans = 0;
		if (ans >= 3)
			ok = true;
	}

	printf(ok ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,A=0;
  cin >> N;
  vector<int>vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  for(int i=1; i<=N; i++){
    if(i%2 == 1 && vec.at(i-1)%2 == 1){
      A++;
    }
  }
  cout << A << endl;
}

Measured memory_bytes: 3548
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int k; cin >> k;
    string s; cin >> s;
    int si = SIZE(s);
    if(si <= k) cout << s << endl;
    else{
        rep(i,k){
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}


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

int main(){
	int x,ans,r;
	cin>>x;
	ans=0;
	while(x>=500){
		r=x/500;
		x=x%500;
		ans+=(r*1000);
	}
	r=0;
	while(x>=5){
		r=x/5;
		x=x%5;
		ans+=(r*5);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007

int main()
{
   ll n,k;
   cin>>n>>k;
   ll a[n];
   ll b[n];
   b[0]=0;
   ll sum=0,c=0;
   for(ll i=0;i<n;i++)
   {
       cin>>a[i];
   }
   for(ll i=1;i<n;i++)
   {
       b[i]=a[i]-a[i-1];
   }
  
   for(ll i=1;i<n;i++)
   {
       sum=sum+b[i];
       c++;
       if(c==k)
       {
           //cout<<sum<<endl;
           if(sum>0)
           cout<<"Yes"<<endl;
           else
           cout<<"No"<<endl;
           sum=sum-b[i-c+1];
           c=c-1;
       }
   }
   
}

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


int main() {
long N,A,B;
cin>>N>>A>>B;
vector<long> p(N);
for(int i=0;i<N;i++) cin>>p[i];
long q1=0,q2=0,q3=0;
for(int i=0;i<N;i++){
  if(p[i]<=A) q1++;
  else if(p[i]<=B) q2++;
  else q3++;
}
cout<<min(q1,min(q2,q3))<<endl;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main() {
  string S;
  cin >> S;
  int l=S.length(), count=0;
  for(int i=0; i < l-1; i++) {
     if(S.at(i) != S.at(i+1)) count++;
  }
  cout << count << endl;
}


Measured memory_bytes: 512
import itertools
n,m,x=[int(x) for x in input().split()]
book=[]
for i in range(n):
  b=[int(x) for x in input().split()]
  book.append(b)
 
l=[]
a=itertools.product(range(2),repeat=n)
for i in a:
  l.append(i)
 
price=[]
for i in range(2**n):
  check_list=[0]*(m+1)
  for j in range(n):
    if l[i][j]==1:
      for k in range(m+1):
        check_list[k]+=book[j][k]
  check=[]
  for p in range(1,m+1):
    if check_list[p]<x:
      check.append(False)
  if check==[]:
    price.append(check_list[0])
 
if price==[]:
  print("-1")
else:
  print(min(price))

Measured memory_bytes: 9640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int De;
  cin>>De;
  vector<vector<int>> vec(De, vector<int>(26));
  vector<int>ve(De);
  for(int X=0;X<De;X++){
    cin>>ve.at(X);
  }
  for (int i = 0; i < De; i++) {
    for (int j = 0; j < 26; j++) {
      cin>>vec.at(i).at(j);
    }
  }
  for(int X=0;X<De;X++){
    cout<<1<<endl;
  }
}


Measured memory_bytes: 3700
// #1140935 Solution for 0515: School Road by ryogo 
#include<iostream>
using namespace std;
int dp[18][18];
int main(){
	int a, b ,i, j, x, y;
	while(cin >> a >> b){
		if(a == 0 && b == 0) { break; }
		int n;
		cin>>n;
		for(i=0; i<=17; i++){for(j=0; j<=17; j++){dp[i][j] = 0;}}
		for(i=1; i<=n ; i++){
			cin >> x >> y; dp[y][x] = -1;
		}
		dp[1][1] = 1;
		for(i=1; i<=b; i++){
			for(j=1; j<=a; j++){
				if(i==1 && j==1)continue;
				if(dp[i][j] != -1){
					dp[i][j] = dp[i][j-1] + dp[i-1][j];
				}
				else dp[i][j] = 0;
			}
		}
 
		cout << dp[b][a] << endl;
	}
}


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

using namespace std;

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

  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  vector<double> dp(n);
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    g[u - 1].push_back(v - 1);
  }
  for (int i = n - 2; i >= 0; --i) {
    for (int to : g[i]) {
      dp[i] += (dp[to] + 1) / g[i].size();
    }
  }
  double ans = dp[0];
  for (int k = 0; k < n; ++k) {
    if (g[k].size() == 1) {
      continue;
    }
    fill(dp.begin(), dp.end(), 0);
    for (int i = n - 2; i >= 0; --i) {
      double sum = 0, mx = 0;
      for (int to : g[i]) {
        sum += dp[to] + 1;
        mx = max(dp[to] + 1, mx);
      }
      if (i == k) {
        dp[i] = (sum - mx) / (g[i].size() - 1);
      } else {
        dp[i] = sum / g[i].size();
      }
    }
    ans = min(ans, dp[0]);
  }
  cout << fixed << setprecision(10) << ans;

  return 0;
}

Measured memory_bytes: 1408
N, K , Q = map(int, input().split())
A = []
P = []
for i in range(Q):
    A.append(int(input()))

for i in range(N):
    P.append(int(K))


for i,x in enumerate(A):
    P[x-1] += 1


for i,x in enumerate(P):
    if x - Q > 0:
        print("Yes")
    else:
        print("No")




Measured memory_bytes: 10480
#include<iostream>

using std::cout;
using std::cin;
using std::endl;

int main(void) {
int a;
int b;
int c;
int count = 0;

cin >> a >> b >> c;
for (int i = a; i <= b; i ++) {
if (c % i == 0) {
count ++;
}
}
cout << count << endl;
return 0;
}

Measured memory_bytes: 3048
#include <cstdio>
int main(){
    int h, w, sum = 0;
    int i, j;
    scanf("%d%d", &h, &w);
    int sheet[101][101] = {};
    for (i = 0; i < h; i++){
        for (j = 0; j < w; j++){
            scanf("%d", &sheet[i][j]);
            sum += sheet[i][j];
        }
        sheet[i][w] = sum;
        sum = 0;
    }
    for (int k = 0; k < w + 1; k++){
        for (int l = 0; l < h; l++){
            sheet[h][k] += sheet[l][k];
        }
    }
    for (int k = 0; k < h + 1; k++){
        for (int l = 0; l < w + 1; l++){
            printf("%d", sheet[k][l]);
            if (l != w) printf(" ");
        }
        printf("\n");
    }
    
    return 0;
}

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

vector<int> rihuru(vector<int> &a) {
  int n = a.size() / 2;

  vector<int> c[2];
  rep(i, a.size()) {
    if (i < n)
      c[0].emplace_back(a[i]);
    else
      c[1].emplace_back(a[i]);
  }

  vector<int> res;
  rep(i, n) {
    res.emplace_back(c[0][i]);
    res.emplace_back(c[1][i]);
  }

  // for (auto i : res) cout << i << ' ';
  // cout << endl;

  return res;
}

vector<int> cut(vector<int> &a, int k) {
  vector<int> res;
  loop(i, k, a.size()) { res.emplace_back(a[i]); }
  rep(i, k) { res.emplace_back(a[i]); }

  return res;
}

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

  vector<int> a(n + n);
  rep(i, n + n) a[i] = i + 1;
  // iota(a.begin(), a.end(), 1);
  rep(i, m) {
    int k;
    cin >> k;

    if (k == 0) {
      a = rihuru(a);
    } else {
      a = cut(a, k);
    }
  }

  for (auto i : a) { cout << i << endl; }
}



Measured memory_bytes: 3160
a = int(input())
b = int(input())
c = int(input())
s = 3 * c

l = [
    [a, b, s-a-b],
    [2*s-2*a-b-2*c, c, 2*a+b+c-s],
    [a+b+2*c-s, s-b-c, s-a-c]
]

for i in l:
    print(*i)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int first(vector<int> h){
    for(int i=0;i<h.size();i++){
        if(h[i]!=0){
            return i;
        }
    }
    return -1;
}
int last(vector<int> h,int left){
    for(int i=left;i<h.size();i++){
        if(h[i]==0) return i-1;
    }
    return h.size()-1;
}
void water(vector<int> &h,int left,int right,int &ans){
    for(int i=left;i<=right;i++){
        h[i]--;
    }
    ans++;
}
bool allzero(vector<int> h){
    for(int i=0;i<h.size();i++){
        if(h[i]>0) return false;
    }
    return true;
}
int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;i++) cin >> h[i];
    int ans=0;
    while(!allzero(h)){
        int left=first(h);
        int right=last(h,left);
        water(h,left,right,ans);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		while(in.hasNext())	
		{
			char ch[]=in.nextLine().toCharArray();
			char a=1;
			int ju=0;
			for(int i=0;i<26;i++)
			{
				for(int j=0;j<ch.length;j++)
				{
					if(ch[j]+a>122)
						ch[j]='a';
					else if(ch[j]==' ')
						continue;
					else if(ch[j]=='.')
						continue;
					else
						ch[j]=(char) (ch[j]+a);
				}
				for(int j=0;j<ch.length;j++)
				{
					if(j+2<ch.length&&ch[j]=='t'&&ch[j+1]=='h'&&ch[j+2]=='e')
					{
						ju=1;
						break;
					}
					else if(j+3<ch.length&&ch[j]=='t'&&ch[j+1]=='h'&&ch[j+2]=='i'&&ch[j+3]=='s')
					{
						ju=1;
						break;
					}
					else if(j+3<ch.length&&ch[j]=='t'&&ch[j+1]=='h'&&ch[j+2]=='a'&&ch[j+3]=='t')
					{
						ju=1;
						break;
					}
				}
				if(ju==1)
					break;
			}
			System.out.println(ch);
		}
	}
}

Measured memory_bytes: 12000
#include <iostream>
#include <string>
#include <map>
#include <sstream>
#include <algorithm>
#include <functional>
#include <cstdio>
using namespace std;

int L;

int to_i(string s) {
	int n;
	istringstream is(s);
	is >> n;
	return n;
}

string to_s(int n) {
	ostringstream os;
	os << n;
	return os.str();
}

string format(string a) {
	char buf[L+1];
	char format_str[] = "%0xd"; format_str[2] = L+'0';
	sprintf(buf, format_str, to_i(a));
	return string(buf);
}	

string next(string a) {
	a = format(a);
	int minimum, maximum;
	sort(a.begin(), a.end());
	minimum = to_i(a);
	sort(a.begin(), a.end(), greater<char>());
	maximum = to_i(a);
	return to_s(maximum - minimum);
}

int main() {
	string a;
	while (cin >> a >> L) {
		if (a == "0" && L == 0) break;
		map<string, int> gen;
		int i = 0;
		gen[a] = 0;
		while (true) {
			a = next(a); i++;
			if (gen.count(a)) {
				break;
			}
			gen[a] = i;
		}
		cout << gen[a] << ' ' << a << ' ' << i - gen[a] << endl;
	}
	return 0;
}

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

int main(){
  string s;
  cin >> s;
  int price = 700;
  
  if(s.at(0) == 'o') price += 100;
  if(s.at(1) == 'o') price += 100;
  if(s.at(2) == 'o') price += 100;
  
  cout << price << endl;
}


Measured memory_bytes: 3596
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <sstream>

using namespace std;

int main() {
    int a,b,c;

    cin >> a >> b >> c;

    if(b - a == c - b){
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl; 
    }
    
    return 0;
}




Measured memory_bytes: 256