akhauriyash/Code-Regression huggingface dataset:
#include <iostream>

int main()
{
    long long a[7];
    for(int i=0; i<7; i++) scanf(" %lld", &a[i]);

    long long I = a[0];
    long long O = a[1];
    long long J = a[3];
    long long L = a[4];

    long long K = O + I + J + L;
    long long odd = I % 2 + J % 2 + L % 2;
    if(odd == 1 || odd == 2) K -= 1;
    if(odd == 2){
        if((I==1 && J==1) || (J==1 && L==1) || (L==1 && I==1)) K -= 1;
    }

    std::cout << K << std::endl;
}

Measured memory_bytes: 256
n = gets.chomp
f = false

(1..9).map{ |i|
  k = i * 100 + i * 10 + i
  if n.include?(k.to_s)
    puts "Yes"
    f = true
    break
  end
}

if !f and n.include?("000")
  puts "Yes"
elsif !f
  puts "No"
end


Measured memory_bytes: 1788
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);

		int H = scanner.nextInt(), W = scanner.nextInt();

		char[][] map = new char[H][];

		for (int i = 0; i < H; i++) {

			map[i] = scanner.next().toCharArray();

		}

		int[][] dp = new int[H][W];

		for (int i = 1; i < H; i++) {

			dp[i][0] = map[i][0] - '0' + dp[i - 1][0];
		}
		for (int i = 1; i < W; i++) {

			dp[0][i] = map[0][i] - '0' + dp[0][i - 1];
		}

		for (int i = 1; i < H; i++) {
			for (int j = 1; j < W; j++) {
				dp[i][j] = (map[i][j] - '0') + Math.min(dp[i][j - 1], dp[i - 1][j]);
			}
		}

		System.out.println(dp[H - 1][W - 1]);
	}
}

Measured memory_bytes: 26428
(defparameter mod-number 1000000007)

(defun unfold (p f g seed &optional (tail-gen (lambda () '())))
  (if (p seed)
      (tail-gen seed)
	  (cons (f seed)
	        (unfold p f g (g seed) tail-gen))))
  
(defun iota (c &optional (s 0) (step 1) (acc nil))
  (if (zerop c)
      (reverse acc)
      (iota (1- c) (+ s step) step (cons s acc))))
 
(defun sum (list &optional (init 0))
  (reduce #'+ list :initial-value init))
 
(defmacro debug-print (x)
  `(let ((y ,x))
    (format t "~A: ~A~%" ',x y)
	y))

(defun solve (r d x &optional (c 0) (acc nil))
  (if (= c 10)
      (reverse acc)
      (let ((next (- (* r x) d)))
           (solve r d next (1+ c) (cons next acc)))))

(format t "~{~A~%~}" (solve (read) (read) (read)))


Measured memory_bytes: 15076
import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		double x1, x2, x3, y1, y2, y3, xp, yp;
		double s1, s2, s3,s4;

		while (scan.hasNext()) {
			x1 = scan.nextDouble();
			y1 = scan.nextDouble();
			x2 = scan.nextDouble();
			y2 = scan.nextDouble();
			x3 = scan.nextDouble();
			y3 = scan.nextDouble();
			xp = scan.nextDouble();
			yp = scan.nextDouble();

			s1=Math.abs((x1*y2+x2*y3+x3*y1-y1*x2-y2*x3-y3*x1)/2);
			s2=Math.abs((xp*y2+x2*y3+x3*yp-yp*x2-y2*x3-y3*xp)/2);
			s3=Math.abs((x1*yp+xp*y3+x3*y1-y1*xp-yp*x3-y3*x1)/2);
			s4=Math.abs((x1*y2+x2*yp+xp*y1-y1*x2-y2*xp-yp*x1)/2);

			if (s1 ==s2 + s3+s4) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}

	}

}

Measured memory_bytes: 21476
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>
#include <utility>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
using ull = unsigned long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

int main() {
  ull a, b, c;
  cin >> a >> b >> c;

  if (a == b && b == c) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
h, w = map(int,input().split())
a = []
for i in range(h):
    a.append(list(input()))
#print(a)

for i in range(w+1):
    print('#', end = '')
print('#')

for i in range(h):
    print('#', end = '')
    for j in range(w):
        print(a[i][j], end = '')
    print('#')

for i in range(w+1):
    print('#', end = '')
print('#')


Measured memory_bytes: 4596
#include <bits/stdc++.h>
#define INF 1000000000
#define MAXN 110000
using namespace std;

long long h[MAXN], dp[MAXN];
int N;

int main()
{
    fill(dp, dp + MAXN, INF);
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> h[i];
    }
    dp[0] = 0;
    for (int i = 0; i < N - 1; i++)
    {
        dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i + 1] - h[i]));
        dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i + 2] - h[i]));
    }
    cout << dp[N - 1];
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define all(x) x.begin(), x.end()

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long long ll;

template <typename T> void max_self(T& a, T b){
	a = max(a,b);
}

void solve(){	
  int n,m;cin>>n>>m;
  vi v(m);
  ll sum = 0;
  for(int i=0;i<m;i++){
    cin>>v[i];
    sum+=v[i];
  }
  ll ans = (ll)n-sum;
  max_self(ans,(ll)-1);
  cout<<ans<<endl;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    //int t; cin >> t;
    //while(t--) solve();
    //
    solve();
    return 0;
}

Measured memory_bytes: 3708
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using Int = long long;
int main()
{
    int W, H, N; cin >> W >> H >> N;
    int B[100][100] = {};
    for (int i = 0; i < N; i++) {
        int x, y, a; cin >> x >> y >> a;
        int x_start = 0, x_end = W;
        int y_start = 0, y_end = H;
        switch (a) {
        case 1: x_end = x; break;
        case 2: x_start = x; break;
        case 3: y_end = y; break;
        case 4: y_start = y; break;
        }
        for (int s = y_start; s < y_end; s++) {
            for (int t = x_start; t < x_end; t++) {
                B[s][t] = 1;
            }
        }
    }
    int sum = 0;
    for (int y = 0; y < H; y++) {
        for (int x = 0; x < W; x++) {
            sum += !B[y][x];
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define Matrix vector<vector<int> >
// #define Matrix vector<vector<int> >
#define double long double
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define td(v) v.begin(),v.end()
#define tdr(v) v.rbegin(),v.rend()
// #define endl "\n"
#define Matrix vector<vector<int> >
using namespace std;
const int MOD = 1e9+7;
const long long INF = 5e18;
const double pi = acos(-1.0);
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int lcm(int a,int b){return (a*b)/gcd(a,b);}
 
inline long long mod(long long n, long long m){
    long long ret = n%m;
    if(ret < 0) ret += m;
    return ret;
}
 
double rad(double x){
    return x*pi/180.0;
}
 
bool isleft(pair<int,int> a, pair<int,int> b, pair<int,int> c){
    int det = (b.first-a.first)*(c.second-a.second) - (c.first-a.first)*(b.second-a.second);
    if(det>=0) return true;
    if(det<0) return false;
    return false;
}
 
int exp(int a, int b){
    int result = 1;
    while (b > 0){
        if (b & 1)
            result = mod(result*a,MOD);
 
        b >>= 1;
        a = mod(a*a,MOD);
    }
    return result;
}
int memo[123456];
vector<int>adj[123456];
int dp(int v){
    int &ans = memo[v];
    if(ans!=-1) return ans;
    ans = 0;
    for(int &to : adj[v]){
        ans = max(ans,1+dp(to));
    }
    return ans;
}
void solve(){
    memset(memo,-1,sizeof(memo));
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int a,b;
        cin>>a>>b;
        adj[a].push_back(b);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        ans = max(ans,dp(i));
    }
    cout<<ans<<endl;
}

signed main(){
    fastio;
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}

Measured memory_bytes: 12560
import java.io.PrintWriter
import java.util.*

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val N = nextInt()
    val A = nextIntList()
    val B = ArrayList<Int>()
    val C = Counter<Int>()
    for (i in A.indices) {
        B.add(A[i] + (i + 1))
        C.add(A[i] - (i + 1))
    }
    val ans = B.map { C.get(-it) }.sum()
    println(ans)
}

class Counter<T> {
    val map = HashMap<T, Long>()

    fun add(k: T, d: Int = 1): Long {
        val v = map.getOrPut(k) { 0L }
        map[k] = v + d
        return v + d
    }

    fun addAll(m: Map<T, Int>) {
        for ((k, v) in m.entries) {
            add(k, v)
        }
    }

    fun get(i: T) = map.getOrDefault(i, 0L)

    override fun toString(): String {
        return map.toString()
    }
}

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

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int result = 0;
	for (int i = 1; i <= n; i++) {
		int sum = 0;
		string numStr = to_string(i);
		for (int j = 0; j < numStr.size(); j++) {
			int num = numStr.at(j) - '0';
			sum += num;
		}
		//cout << i << ' ' << sum << endl;
		if (sum >= a && sum <= b) {
			result += i;
		}
	}
	cout << result << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  int a,b;
  cin>>a>>b;
  int ans=0;
  loop(i,a,b+1){
    string s=to_string(i);
    if(s[0]==s[4] && s[1]==s[3])ans++;
  }
  cout<<ans<<endl;
}


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

int main(void){

    int N, M;
    cin >> N >> M;

    int array[M];
    int dist_list[M-1];

    int bef, d;
    for (int i=0; i<M; ++i) cin >> array[i];

    sort(array, array+(M));

    for (int i=0; i<M; ++i) {

        if (i==0) {
            bef  = array[i];
            continue;
        }
        else
            d = array[i] - bef;
            dist_list[i-1] = d;
            bef = array[i];
    };

    sort(dist_list, dist_list+(M-1), greater<int>());

    int result;
    result = 0;

    if (M-N<=0){
        cout << 0 << endl;
    }
    else{
        for (int i=N-1; i<M-1; ++i) {
            if (i<0) continue;
            result += dist_list[i];
        // for (int i=0; i<M-1; ++i) 
        //     cout << dist_list[i] << ' ';
        };
        cout << result << endl;
    };

}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long int
int32_t main() 
{ 
	int n;
	cin>>n;
	int A[n];
	int B[n+1]={0};
	for(int i=1;i<n;i++)
	{
	     cin>>A[i];
	     B[A[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
	     cout<<B[i]<<"\n";
	}

	return 0; 
}

Measured memory_bytes: 6752
#include<stdio.h>

int parent(int);
int right(int);
int left(int);

#define MAX 100000

int main()
{
  int i,kazu,A[MAX+1];

  scanf("%d",&kazu);

  for(i=1;i<=kazu;i++)
    scanf("%d",&A[i]);

  for(i=1;i<=kazu;i++)
    {
      printf("node %d: key = %d, ",i,A[i]);

      if(parent(i)>=1) printf("parent key = %d, ",A[parent(i)]);
      if(left(i)<=kazu) printf("left key = %d, ",A[left(i)]);
      if(right(i)<=kazu) printf("right key = %d, ",A[right(i)]);

      printf("\n");
    }

  return 0;
}


int parent(int i) {return i/2;}
int left(int i) {return 2*i;}
int right(int i){return 2*i+1;}



Measured memory_bytes: 2056
#include <iostream>

using namespace std;

int main(){
	int W,H,x,y,r;
	cin >>W>>H>>x>>y>>r;
	if(x<-100||y<-100||x>100||y>100||W<0||H<0||r<0||W>100||H>100||r>100){
		cout << "error." << endl;
		return 0;
	}
	if((x-r)<0){
		cout << "No" << endl;
	}else if((x+r)>W){
		cout << "No" << endl;
	}else if((y-r)<0){
		cout << "No" << endl;
	}else if((y+r)>H){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 3044
a = []
for i in range(5):
    a.append(int(input()))
k = int(input())
isOK = True
for i in range(5):
    for j in range(i+1,5):
        if abs(a[i]-a[j])>k:
            isOK = False
            break
if isOK:
    print('Yay!')
else:
    print(':(')

Measured memory_bytes: 9004
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define SZ(x) (int)x.size()
#define int ll

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, a, b;
	cin >> n >> a >> b;
	if ((b - a) % 2 == 0) {
		cout << (b - a) / 2 << '\n';
	} 
	else {
		cout << min(a - 1 + (b - a + 1) / 2, n - b + (b - a + 1) / 2) << '\n';
	}
}

Measured memory_bytes: 256
H, W  = map(int, input().split())
right = []
ans = []
for i in range(H):
    if W == 1:
        right.append(int(input()))
    else:
        As = list(map(int, input().split()))
            
        for j in range(W-1):
            if As[j]%2 == 1:
                ans.append([i+1,j+1,i+1,j+1+1])
                As[j] -= 1
                As[j+1] += 1
        right.append(As[j+1])

for i in range(H-1):
    if right[i]%2 == 1:
        ans.append([i+1,W,i+1+1,W])
        right[i] -= 1
        right[i+1] += 1

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



Measured memory_bytes: 28044
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var primes = new List<long>();
            for (var i = 6; i <= 55555; i += 5)
                if (isPrime(i)) primes.Add(i);
            WriteLine(string.Join(" ", primes.Take((int)N)));
        }
        static bool isPrime(long x)
        {
            if (x <= 1) return false;
            if (x == 2) return true;
            if (x % 2 == 0) return false;
            for (long i = 3; i * i <= x; i += 2)
                if (x % i == 0) return false;
            return true;
        }

        static long Mod = 998244353;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
    }
}

Measured memory_bytes: 27844
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll a,b,x;
  cin >> a >> b >> x;
  ll ans=0;
  if(a%x!=0)a+=x-a%x;
  if(b%x!=0)b-=b%x;
  cout << (b-a)/x+1 << endl;
return 0;}

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

int main(){
    
    vector<int>vec(3);
    cin>>vec[0];
    cin>>vec[1];
    cin>>vec[2];
    sort(vec.begin(), vec.end());
    int cost=0;
    while(vec[1]<vec[2]){
        cost++;
        vec[0]++;
        vec[1]++;
    }
    while(vec[0]<vec[1]){
        if(vec[0]+1==vec[1]){
            cost+=2;
            vec[0]++;
        }
        else{
            cost++;
            vec[0]+=2;
        }
    }


    cout<<cost<<endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int q,h,s,d,n;
  cin>>q>>h>>s>>d>>n;
  q*=4;
  h*=2;
  int p=min(min(q,h),s);
  int ans=0;
  if(p*2>d){
    ans+=n/2*d;
    if(n%2) ans+=p;
  }else ans=n*p;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 764
sx, sy, tx, ty = [int(x) for x in input().split()]
ss = ''
for i in range(tx - sx):
    ss += 'R'
for i in range(ty - sy):
    ss += 'U'
for i in range(tx - sx):
    ss += 'L'
for i in range(ty - sy):
    ss += 'D'
ss += 'D'
for i in range(tx - sx + 1):
    ss += 'R'
for i in range(ty - sy + 1):
    ss += 'U'
ss += 'L'
ss += 'U'
for i in range(tx - sx + 1):
    ss += 'L'
for i in range(ty - sy + 1):
    ss += 'D'
ss += 'R'
print(ss)

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

typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mkmap;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<pii> vp;
typedef vector<vi> vv;

#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
const ll mod=1000000007;
const int sz=1000001;
#define endl "\n"
#define all(a) (a).begin(),(a).end()
#define rep(i,a,b) for(i=a;i<b;++i)
#define rrep(i,a,b) for(i=a;i>=b;--i)
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define db(x) cout << (#x) << " = " << x << endl;

inline ll mult(ll a, ll b) {return (((a % mod) * (b % mod)) % mod);}

int f(vi x){
    return x[0]*x[0]+x[1]*x[1]+x[2]*x[2]+x[0]*x[1]+x[1]*x[2]+x[2]*x[0];
}

int main(){
    fast;
    int t,tt,tti,n,m,x,y,z,i,j,k,count,o,e,ans,sum,l,r,mx,mn;
    ll lx,ly,lz,ltemp;
    double fx,fy,fz;
    string s;
    
    queue<vector<int> > q;
    map<vi,bool> mp;
    vi temp;
    temp.pb(1);
    temp.pb(1);
    temp.pb(1);
    q.push(temp);

    cin>>n;
    vi a(n+1);
    while(!q.empty()){
        temp=q.front();
        sort(all(temp));
        q.pop();
        if(mp[temp]) continue;
        mp[temp]=true;
        x=f(temp);
        if(x<=n){
            // for(auto p:temp) cout<<p<<" ";
            // cout<<endl;
            if(temp[0]==temp[1] && temp[0]==temp[2]) a[x]+=1;
            else if(temp[0]==temp[1] || temp[1]==temp[2]) a[x]+=3;
            else a[x]+=6;
            rep(i,0,3){
                temp[i]++;
                q.push(temp);
                temp[i]--;
            }
        }
    }
    rep(i,1,n+1) cout<<a[i]<<endl;
}

Measured memory_bytes: 8376
#include <iostream>
using namespace std;
long long INF = 1e18;
int main()
{
    int n;
    cin >> n;
    long long a[n];
    for (int i = 0; i < n; i++)
    {
        long long temp;
        cin >> temp;
        a[i] = temp;
        if (temp == 0)
        {
            cout << 0 << endl;
            return 0;
        }
    }
    long long ans = 1;
    for (int i = 0; i < n; i++)
    {
        if (a[i] > INF / ans)
        {
            cout << -1 << endl;
            return 0;
        }
        ans *= a[i];
    }
    cout << ans << endl;
    return 0;
}


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

int main() {
    //
    long double a, b, c;
    long double EPS = 1e-14;
    cin >> a >> b >> c;

    if (sqrtl(a) + sqrtl(b) < sqrtl(c)-EPS) cout << "Yes";
    else cout << "No";

    //
}


Measured memory_bytes: 3664
n,m = map(int, input().split())

A = [input() for _ in range(n)]
B = [input() for _ in range(m)]

ans = 'No'

for l_i in range(n-m+1):
  for n_i in range(n-m+1):
    sub_A = [A[l_i+m_i][n_i:n_i+m] for m_i in range(m)]
    if sub_A == B:
      ans = 'Yes'
      
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
  #include <vector>
  #include <math.h>
  #include <string>
  #include <algorithm>
  #include <stack>
  #include <queue>
  #include <ctype.h>
  #include <unordered_map>
  #include <set>
  #include <iterator>
  #include <deque>
  #include <string.h>
  using namespace std;

  typedef long long int lli;


  #define MOD (lli)(1e9+7)
  #define endl "\n"
  #define pb push_back
  #define TEST_CASES  lli t;cin >> t;while(t--)
  #define forn(i,n) for (int i = 0; i < n; ++i)
  
  int pow(lli x,lli y){
    
    lli res = 1;
    while(y > 0){
      if(y & 1)
        res = (res*x);
      x = (x*x);
      y = y>>1;
    }
    return res;
  }

  

  int main()
  {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vector<int> count(n,0);
    for (int i = 0; i < n-1; ++i)
    {
      int x;
      cin>>x;
      x--;
      count[x]++;
    }
    for (int i = 0; i < n; ++i)
    {
      cout<<count[i]<<endl;
    }

  }


Measured memory_bytes: 3988
N = int(input())
lst = []
for i in range(N):
	A,B = map(int,input().split())
	lst.append((A+B,A,B))
lst.sort()
lst.reverse()
ans = 0
for i in range(N):
	A,B = lst[i][1], lst[i][2]
	if i % 2 == 0:
		ans += A
	else:
		ans -= B
print(ans)

Measured memory_bytes: 22632
import itertools
import math

N, D = [int(x) for x in input().strip().split()]
if D == 1:
    print(int(N*(N-1)/2))
else:
    points = []
    for data in range(N):
        points.append([int(x) for x in input().strip().split()])

    result = 0
    for p1,p2 in itertools.combinations(points, 2):
        distance = 0
        for y,z in zip(p1,p2):
            distance += (y - z) ** 2
        
        distance = math.sqrt(distance)
        if distance.is_integer(): result += 1    
    print(result)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {


    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int data, cnt = 0;
		while(true){//?????????????????????????????§????????????
			data = scan.nextInt();
			if(data == 0){
				break;
			}
			System.out.println("Case " + ++cnt +  ": " + data);
		}
        scan.close();
    }
}

Measured memory_bytes: 41768
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for (int i = (a); i < (b); i++)
#define N 1234567

int n, l, a[N];
vector<int> ans;
int main() {
	scanf("%d %d", &n, &l);
	fo(i,0,n) scanf("%d", a+i);
	fo(i,0,n-1) if (a[i] + a[i+1] >= l) {
		puts("Possible");
		fo(j,0,i) printf("%d\n", j+1);
		for (int j = n-2; j >= i; j--) printf("%d\n", j+1);
		return 0;
	} 
	puts("Impossible");


	return 0;
}

Measured memory_bytes: 1152
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
int main () {
    ll x, y;
    cin >> x >> y;
    if (x < y) swap(x, y);
    if (x - y <= 1) cout << "Brown\n";
    else cout << "Alice\n";
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// c++11
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>

#define mp make_pair
#define mt make_tuple
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

const int INF = 1 << 29;
const double EPS = 1e-9;
const ll MOD = 1000000007;

const int dx[] = {1, 0, -1, 0}, dy[] = {0, -1, 0, 1};
int H,W;
map<char, int> deg;
int main() {
    cin >> H >> W;
    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            char c;
            cin >> c;
            deg[c]++;
        }
    }
    priority_queue<int> que;
    for (const auto &val : deg){
        que.push(val.second);
    }

    for (int i = 0; i < H / 2; i++){
        for (int j = 0; j < W / 2; j++){
            int val = que.top();
            que.pop();
            if (val < 4){
                cout << "No" << endl;
                return 0;
            }
            val -= 4;
            que.push(val);
        }
    }
    if (H % 2 != 0){
        for (int j = 0; j < W / 2; j++){
            int val = que.top();
            que.pop();
            if (val < 2){
                cout << "No" << endl;
                return 0;
            }
            val -= 2;
            que.push(val);
        }
    }
    if (W % 2 != 0 ){
        for (int j = 0; j < H / 2; j++){
            int val = que.top();
            que.pop();
            if (val < 2){
                cout << "No" << endl;
                return 0;
            }
            val -= 2;
            que.push(val);
        }
    }
    cout << "Yes" << endl;
   return 0;
 }


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<pair<int,int>> ps(N);
  F0R(i, N) {
    cin >> ps[i].first;
    ps[i].second = i;
  }
  sort(rrng(ps), [](const pair<int, int>& l, const pair<int, int>& r) {
    return l.first < r.first;
    });

  i64 result = 0;

  multiset<int> is;
  is.insert(-1);
  is.insert(-1);
  is.insert(N);
  is.insert(N);

  F0R(i, N) {

    
    auto it = is.insert(ps[i].second);
    //debug(n);

    // l, r : 自分より大きい数がない最大の区間
    // l2, r2 : 自分より大きい数が0～1個ある最大の区間

    int l = ps[i].second - *(--it);
    int l2 = ps[i].second -*(--it);
    ++it;
    ++it;
    int r = *(++it) - ps[i].second;
    int r2 = *(++it) - ps[i].second;
    //cout << l << ',' << r << " " << l2 << "," << r2 << newl;

    result += (i64)ps[i].first * (l * (r2 - r) + r * (l2 - l));
    //debug(result);

    //Print(is);
  }
  cout << result;
}
#endif


Measured memory_bytes: 5760
#include <bits/stdc++.h>
//#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#include "boost/multiprecision/cpp_int.hpp"
//typedef boost::multiprecision::cpp_int LL;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2

ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
//template<class T>void max(T a,T b){if(a<b)return b;else return a;}
//template<class T>void min(T a,T b){if(a>b)return b;else return a;}
//template<class T>bool Max(T&a, T b){if(a < b){a = b;return 1;}return 0;}
//template<class T>bool Min(T&a, T b){if(a > b){a = b;return 1;}return 0;}

//////////////////////////

int main(){fastio
    ll n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll dp[n][n];
    rep(len,0,n-1){
        rep(i,0,n-1){
            ll j=i+len;
            if(j>=n)continue;
            if(i==j){dp[i][j]=a[i];continue;}
            dp[i][j]=max(a[i]-dp[i+1][j],a[j]-dp[i][j-1]);
        }
    }
    cout<<dp[0][n-1]<<endl;
    return 0;
}



Measured memory_bytes: 70400
from collections import Counter

N = int(input())
S = input()

solver = []
for i in range(N-1):
  X = S[:i+1]
  Y = S[i+1:]
  lst_X = list(Counter(X).keys())
  lst_Y = list(Counter(Y).keys())
  lst_and = set(lst_X) & set(lst_Y)
  solver.append(len(lst_and))
  
print(max(solver))

Measured memory_bytes: 3572
#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <assert.h>
#include<limits.h>


#define eps 1e-8
#define PI 3.141592653589793
#define bsize 512

#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define bs 1000000007

using namespace std;

int longestCommonSubsequence(string s1, string s2, vector<vector<int>>& dp) 
{
    for (int i = 1; i <= s1.size(); i++) 
    {
        for (int j = 1; j <= s2.size(); j++) 
        {
            if (s1[i-1] == s2[j-1]) 
                dp[i][j] = dp[i-1][j-1] + 1;

            dp[i][j] = max({dp[i][j], dp[i][j-1], dp[i-1][j]});
        }
    }
    return dp[s1.size()][s2.size()];
}

int main()
{
    ios_base::sync_with_stdio(false) ;
    cin.tie(NULL) ;
    cout.tie(NULL) ;
    
    string s1, s2; 
    cin >> s1 >> s2;

    vector<vector<int>> dp(s1.size()+1, vector<int>(s2.size()+1, 0));
    int count = longestCommonSubsequence(s1, s2, dp);   // This will give count of lcs and change the dp vector

    string s = "";
    int i = s1.size(), j = s2.size();
    while (i > 0 && j > 0) 
    {
        if (dp[i-1][j-1] + 1 == dp[i][j] && dp[i-1][j] + 1 == dp[i][j] && dp[i][j-1] + 1 == dp[i][j]) 
        {
            i--; 
            j--; 
            s = s1[i] + s; //As we are travelling backward reverse the string
        }
        else if (dp[i][j-1] > dp[i-1][j]) 
            j--;
        else
            i--;
    }
    cout << s << endl;

    return 0;
}

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

int main() {
    int N; cin >> N;
    map<string, int> m;
    int spe = 0;
    for (int i = 0; i < N; i++)
    {
        int x; cin >> x;
        if(x<400) m["hai"]++;
        else if(x<800) m["cha"]++;
        else if(x<1200) m["mid"]++;
        else if(x<1600) m["miz"]++;
        else if(x<2000) m["ao"]++;
        else if(x<2400) m["ki"]++;
        else if(x<2800) m["dai"]++;
        else if(x<3200) m["aka"]++;
        else if(x>=3200) spe++;
    }
    if(m.size()==0&&spe>0) cout << 1 << " " << spe << endl;
    else cout << m.size() << " " << m.size()+spe << endl;
}

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

int main(){
	long long unsigned int a, b, r, gcd, lcm, x, y;
	while(cin >> a >> b){
		r = 1;
		x = a;
		y = b;
		while(r != 0){
			r = x % y;
			x = y;
			y = r;
		}
	
		gcd = x;
		lcm = a * b / gcd;	
	
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

Measured memory_bytes: 1148
//
// 
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vi;
typedef pair<int,int> pi;
#define inf 1e18
#define For(i,a,b) for (int i = a; i < b; i++)
#define Rep(i,a,b) for (int i = a; i <= b; i++)
#define ps(x,y) fixed << setprecision(y) << x 
#define pb push_back 
#define mp make_pair 

char a[55][55], b[55][55];
 
int32_t main()
{
    fast;
    int n,m; cin >> n >> m;
    For(j, 0, n) {
        For(i, 0, n) cin >> a[j][i];
    }

    For(j, 0, m) {
        For(i, 0, m) cin >> b[j][i];
    }

    bool exist = false;

    For(j, 0, n) {
        For(i, 0, n) {
            if(j + m - 1 >= n or i + m - 1 >= n) continue;
            bool match = true;
            For(y, 0, m) {
                For(x, 0, m) {
                    if(a[j + y][i + x] != b[y][x]) match = false;
                }
            }
            if(match) exist = true;
        }
    }

    if(exist) cout << "Yes\n";
    else cout << "No\n";

    
    return 0;
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include <math.h>
using namespace std;
int main(){
	int k,n,max=0,ind;
	cin>>k>>n;
	int home[n];
	cin>>home[0];
	for (int i = 1; i < n; ++i)
	{
		cin>>home[i];
		if((home[i]-home[i-1])>max){
			max=home[i]-home[i-1];
			ind = i;
		}
	}
	int lastgap=(k-home[n-1])+(home[0]-0);
	if (lastgap>=max)
		cout<<home[n-1]-home[0];
	else
	{
		int step=home[n-1]-home[ind];
		step+=lastgap;
		step=step+(home[ind-1]-home[0]);
		cout<<step;
	}
}

Measured memory_bytes: 1152
using System;
using System.Collections.Generic;
using System.Collections;


class p
{
    
    static void Main(string[] args)
    {
        string[] input = Console.ReadLine().Split();
        long a = long.Parse(input[0]), b = long.Parse(input[1]), c = long.Parse(input[2]);

        if (a + c == 2 * b) Console.WriteLine("YES");
        else Console.WriteLine("NO");
    }   
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int K;
  int i;
  int j;
  
  cin >> N >> K;
  i = 1;
  j = K;
  
  if (N <= K) {
    cout << 1;
  }
  
  else {
	  while (j < N) {
    	j = pow (K, i);
    	i = i + 1;
  	}
    
  if (j % N == 0) {
    cout << i;
  }
  
  else {
    cout << i - 1;
  }
  }
}

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

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

int N;
vector<int> A;

void solve(void) {
    vector<int> LDS;

    LDS.push_back(A[1]);
    for(int i = 2;i <= N;i++) {
        auto it = upper_bound(LDS.begin(),LDS.end(),A[i]);
        if(it == LDS.end()) {
            LDS.push_back(A[i]);
        } else {
            *it = A[i];
        }
    }

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

    return;
}

int main(void) {
    cin>>N;

    A.push_back(1);
    for(int i = 0;i < N;i++) {
        int a;
        cin>>a;
        a = -1*a;
        A.push_back(a);
    }

    solve();

    return 0;
}





Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <utility>
using namespace std;

int main(){
  int a, b;
  cin >> a >> b;
  string s;
  cin >> s;
  for(int i = 0; i < s.size(); i++){
    if(i == a){
      if(s[i] != '-'){ cout << "No" << endl; break;}
    }
    else{
      if(s[i] < 48 || s[i] > 57){ cout << "No" << endl; break;}
    }
    if(i == s.size() - 1){cout << "Yes" << endl;}
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
long long n;
scanf("%lli",&n);
for(long long i=1;i<=n;++i){
    long long x = i;
    if(x%3==0){
        printf(" %lli",i);
    }
    else if(x%10==3){
        printf(" %lli",i);
    }

  else{
            while(x>0){
            x= x/10;
            if(x%10==3){
            printf(" %lli",i);
            break;
            }

     }
    }

}

printf("\n");
return 0;
}







Measured memory_bytes: 2060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1e9
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

// 桁数を返す
int cnt_digits(ll X){
    int cnt=0;
    while(X>0){
        X/=10;
        cnt++;
    }
    return cnt;
}

int main(){
    ll n;
    cin>>n;
    int res=(1<<29);
    for(ll A=1;A*A<=n;A++){
        if(n%A==0){
            ll B=n/A;
            int F=max(cnt_digits(A),cnt_digits(B));
            res=min(res,F);
        }
    }
    cout<<res<<endl;
}

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

void Print(vector<int> A) {
  for (int i = 0; i < A.size(); i++) {
    cout << A[i];
    if (i != A.size()-1) {
      cout << " ";
    } else {
      cout << endl;
    }
  }
}

int main() {
  int N; cin >> N;
  vector<int> A(N), C1(MAX, 0), C2(MAX, 0), B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    C1[A[i]]++;
  }
  C2[0] = C1[0];
  for (int i = 1; i < MAX; i++) {
    C2[i] += C2[i-1] + C1[i];
  }
  for (int i = N-1; i >= 0; i--) {
    B[C2[A[i]]-1] = A[i];
    C2[A[i]]--;
  }
  Print(B);
}




Measured memory_bytes: 26308
X=int(input())

if 400<=X<600:
    print(8)
if 600<=X<800:
    print(7)
if 800<=X<1000:
    print(6)
if 1000<=X<1200:
    print(5)
if 1200<=X<1400:
    print(4)
if 1400<=X<1600:
    print(3)
if 1600<=X<1800:
    print(2)
if 1800<=X<2000:
    print(1)


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

int main() {
  int n,m;
  cin>>n>>m;
  vector<int>a(n);
  double sum=0;
  for(int i=0;i<n;i++){
    cin>>a.at(i);
    sum+=a.at(i);
  }
  double hantei=sum/(4*m);
  int count=0;
  for(int i=0;i<n;i++){
    if(a.at(i)>=hantei)count++;
  }
  if(m <=count){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
 
int main(void) {
    int input, ans = 0, ans2 = 234, flag;
    cin >> input;
 
    vector<int> side(input);
    for (int i = 0; i < input; i++) {
        cin >> side.at(i);
    }
 
    sort(side.begin(), side.end());
    reverse(side.begin(), side.end());
 
    vector<int> num;
    num.push_back(0);
    for (int i = 0; i < input; i++) {
        flag = 0;
        for (int j = i + 1; j < input; j++) {
            for (int k = j + 1; k < input; k++) {
                if (side.at(i) < side.at(j) + side.at(k) && side.at(j) < side.at(k) + side.at(i) && side.at(k) < side.at(i) + side.at(j)) {
                    ans++;
                    ans2++;
                }
                else {
                    break;
                    flag++;
                }
            }
            if (flag != 0) {
                break;
            }
        }
    }
 
    cout << ans << endl;
 
}

Measured memory_bytes: 3540
N = int(input())
List = list(map(int,input().split()))
List_t = []
List_q = []
List.sort()
for x in range(N-1):
  if List[x]==List[x+1]:
    List_t.append(List[x])
for x in range(N-3):
  if List[x]==List[x+1]==List[x+2]==List[x+3]:
    List_q.append(List[x])

if len(List_q) == 0:
  if len(List_t)<=1:
    print(0)
  else:
    M = sorted(set(List_t))[-1]
    m = sorted(set(List_t))[-2]
    print(M*m)
else:
  M_q = sorted(set(List_q))[-1]
  M_t = sorted(set(List_t))[-1]
  m = sorted(set(List_t))[-2]
  print(max([M_q**2,M_t*m]))
  

Measured memory_bytes: 14672
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p==NIL) printf("root, ");
  else if(T[u].l==NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r!=NIL) calcDepth(T[u].r,p);
  if(T[u].l!=NIL) calcDepth(T[u].l,p+1);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  int n,d,x,ii,choco=0;

  cin >> n >> d >> x;
  vector<int> human;
  human.resize(n);
  for(ii=0;ii<n;ii++){
	cin >> human[ii];
  }

  for(int dd:human){
	int day=1;
	while(day<=d){
	  choco+=1;
	  day += dd;
	}
  }
  cout << (choco+x) ;
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
  each(x,vec) is >> x;
  return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  rep(i,vec.size()) {
    if (i) os << " ";
    os << vec[i];
  }
  return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
  rep(i,vec.size()) {
    if (i) os << endl;
    os << vec[i];
  }
  return os;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, m; cin >> n >> m;
  cout << n-m+1 << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_c() {
	ll n;
	ll ans;

	cin >> n;

	V a(n);
	rep(i, n) {
		cin >> a[i];
	}

	sort(ALL(a));

	ll now = -1;
	ll cnt = 0;
	ans = 0;
	rep(i, n) {
		if (now == a[i]) {
			cnt++;
		}
		else {
			ans += cnt % 2;
			now = a[i];
			cnt = 1;
		}
	}
	ans += cnt % 2;

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

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

	solve_abc_c();

	return 0;
}

Measured memory_bytes: 1024
package main

import "fmt"

func min(a, b int) int {
	if a >= b {
		return b
	}
	return a
}

func main() {
	var D, G int
	fmt.Scan(&D, &G)
	p := make([]int, D)
	c := make([]int, D)
	for i := range p {
		fmt.Scan(&p[i])
		fmt.Scan(&c[i])
	}

	ans := 10000
	for bit := 0; bit < (1 << uint(D)); bit++ {
		score, solved, restmax := 0, 0, -1
		ok := false
		for j := 0; j < D; j++ {
			if bit&(1<<uint(j)) != 0 {
				score += (j+1)*100*p[j] + c[j]
				solved += p[j]
			} else {
				restmax = j
			}
		}
		if score < G {
			for k := 0; k < p[restmax]; k++ {
				score += (restmax + 1) * 100
				solved++
				if score >= G {
					ok = true
					break
				}
			}
		} else {
			ok = true
		}
		if ok {
			ans = min(ans, solved)
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
# coding: utf-8

num = int(input())
str = input().split()
table = list(str)
table5 = [int(i) for i in table]
count = 0
table2 = sorted(table5)
table3 = [int(i) for i in table2]
for i in range(num):
    if table5[i] == table3[i]:
        continue
    else:
        count += 1

if count == 2 or count == 0:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9132
import bisect

n = int(input())
li = list(map(int, input().split()))
ans = 0

li.sort()

for i in range(n):
  for j in range(i+1, n):
    cnt = bisect.bisect_left(li, li[i]+li[j])
    ans += cnt - j - 1
            
print(ans)

Measured memory_bytes: 3188
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

def abc080_c():
    N = int(readline())  # 他店の数
    # 他店の営業パターン：店→日付→営業01
    F = np.zeros((N, 10), dtype=np.int8)
    for i in range(N): F[i] = readline().split()
    # 他店と何回重なると利益がどうなるか：店→重複回数→利益
    P = np.zeros((N, 11), dtype=np.int32)
    for i in range(N): P[i] = readline().split()
    ans = -10**12  # 最悪 100 * -10**7

    # bit全探索
    from itertools import product
    for mask in product(range(2), repeat=10):
        if mask.count(1) == 0: continue
        profit = 0
        for i in range(N):
            # 他店iの営業パターンと、自店の営業パターンmaskと、の要素積は、重複する営業日
            overlap = np.multiply(F[i,:], mask).sum()
            profit += P[i, overlap]
        ans = max(profit, ans)
    print(ans)

abc080_c()

Measured memory_bytes: 20640
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main() {
    ll n,a,b;
    std::cin >> n>>a>>b;
    vector<ll> h(n);
    for (int i = 0; i < n; i++) {
        std::cin >> h[i];
    }

    ll r = 1e10;
    ll l = 0;
    // r ok, l だめ
    while(r-l>1){
        ll mid = (r+l)/2;
        ll tmp = 0;
        for (int i = 0; i < n; i++) {
            if( (h[i]-mid*b) >0){
                tmp += (h[i]-mid*b+(a-b-1))/(a-b);
            }
        }
        if(mid<tmp){
            l = mid;
        }else{
            r = mid;
        }
    }
    std::cout << r << std::endl;
}


Measured memory_bytes: 1024