akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

class Main {
	public static void main(String[] $) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),sum=0,cmin=Integer.MAX_VALUE,min=Integer.MAX_VALUE,max=Integer.MIN_VALUE;
		int[] a=new int[n];
		for(int i=0;i<n;i++) {
			a[i]=sc.nextInt();
			max=Math.max(max, a[i]);
			min=Math.min(min, a[i]);
		}
		for(int i=min;i<=max;i++) {
			for(int j=0;j<n;j++) {
				sum+=(a[j]-i)*(a[j]-i);
			}
			cmin=Math.min(sum, cmin);
			//System.out.println(sum);
			sum=0;
		}
		System.out.println(cmin);
	}
}

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

int a, b;

int main() {
    cin >> a >> b;
    if (a < b) {
        cout << "a < b" << endl;
    }
    else if (a > b) {
        cout << "a > b" << endl;
    }
    else cout << "a == b" << endl;
}


Measured memory_bytes: 3084
use proconio::input;

fn main() {
    input! {
        n: usize,
        mut b: [usize; n],
    }

    let mut ans = vec![];
    'outer: for _ in 0..n {
        let b_len = b.len();
        for j in 0..b_len {
            let index = b_len - 1 - j;
            if b[index] == index + 1 {
                ans.push(index + 1);
                b.remove(index);
                //println!("index {}", index+1);
                continue 'outer;
            }
        }
        println!("{}", -1);
        return;
    }

    for na in ans.iter().rev() {
        println!("{}", na);
    }
}


Measured memory_bytes: 2152
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            Solve();
        }
        private const int MOD = 1000000007;
        private static long n = 0;
        private static long ans = 0;
        private static int[] table = new int[9];
        private static HashSet<int> hash = new HashSet<int>();
        static void Solve()
        {
             n = ReadAndParseLong();

            Check(9);
            Console.WriteLine(ans);
        }

        private static void Check( long depth )
        {
            if( depth == 0)
            {
                long d = 0;
                for(int i=0;i<table.Length;++i)
                {
                    d += table[i] * pow(10, i);
                }
                if( d > n) { return; }
                hash.Clear();

                string s = d.ToString();
                for(int i=0;i<s.Length;++i)
                {
                    int tmp = s[i] - '0';
                    if(tmp == 0) { return; }
                    if(!hash.Contains(tmp))
                    {
                        hash.Add(tmp);
                    }
                }
                if( hash.Count != 3) { return; }
                ans++;
            }
            else
            {
                table[depth - 1] = 0;
                Check(depth - 1);
                table[depth-1] = 3;
                Check(depth - 1);
                table[depth-1] = 5;
                Check(depth - 1);
                table[depth-1] = 7;
                Check(depth - 1);
            }
        }
#region よく使う便利関数
        private static bool isPrime(long x)
        {
            if (x == 2) { return true; }
            if (x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while (i * i <= x)
            {
                if (x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if (n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if (n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
#endregion
    }
}

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

int main() {

  int N = 0;
  cin >> N;
  
  char S;
  bool  p = false, w = false, g = false, y = false;
  
  for (int i = 0; i < N; i++) {
    cin >> S;
    
    if (S == 'P') {
      p = true;
    } else if (S == 'W') {
      w = true;
    } else if (S == 'G') {
      g = true;
    } else if (S == 'Y') {
      y = true;
    }
  }

  if (p && w && g && y) {
    cout << "Four" << endl;
  } else if ((p && g && w) || (g && w && y) || (p && w && y) || (p && g && y)) {
    cout << "Three" << endl;
  }
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 1e5 + 10;
int a[N];
int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) cin >> a[i];
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		if (a[i] == i) swap(a[i], a[i + 1]), ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 640
import java.text.DecimalFormat;
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int d;
        int r;
        double f;

        d = a / b;
        r = a % b;
        f = ((double) a) / b;
       
        DecimalFormat df = new DecimalFormat("0.000000000");
        //  DecimalFormat df = new DecimalFormat("###.000");
        String n = df.format(f);
        System.out.println(d + " " + r + " " + n);
    }
}

Measured memory_bytes: 26464
A, B, C, D, E, F = map(int, input().split())
water = set()
sugar = set()
sugar_water = []

for i in range(F // (100 * A) + 1):
    for j in range(F // (100 * B) + 1):
        if 100 * A * i + 100 * B * j <= F:
            water.add(100 * A * i + 100 * B * j)

for i in range(F // C + 1):
    for j in range(F // D + 1):
        if C * i + D * j <= F:
            sugar.add(C * i + D * j)

for i in water:
    for j in sugar:
        if 0 < i + j <= F and j / (i + j) <= E / (100 + E):
            sugar_water.append([i + j, j])

max_sugar_water = max(sugar_water, key=lambda x: x[1] / x[0])
print("{} {}".format(max_sugar_water[0], max_sugar_water[1]))

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

H = list(map(int, input().split()))
dist = []
for i in range(N):
  dist.append([])
for i in range(M):
  n1, n2 = map(int, input().split())
  dist[n1-1].append(n2-1)
  dist[n2-1].append(n1-1)

ans = 0
  
for i in range(len(dist)):
  isHigh = True
  for j in dist[i]:
    if H[j] >= H[i]:
      isHigh = False
  if isHigh:
    ans += 1
print(ans)

Measured memory_bytes: 29568
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

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

#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (ll)1e18
#define mod (inf+7)

int n,a,b;

int main() {
		ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
		cin>>n>>a>>b;
		int x=abs(a-b);
		if(x%2==0){
				cout<<"Alice\n";
		}
		else cout<<"Borys\n";






		return 0;
}

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

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    reverse(S.begin(), S.end());
    for (int i = 0; i<4; i++) reverse(divide[i].begin(), divide[i].end());

    bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false;
        for (int j = 0; j < 4; j++) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) {
                can2 = true;
                i += d.size();
                break;
            }
        }
        if (!can2) {
            can = false;
            break;
        }
    }
    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 512
n=int(input())
l=[[] for i in range(n+1)]
for i in range(1,1+n):
  l1=list(input())
  for j in range(1,1+n):
    if l1[j-1]=="1":
      l[i].append(j)
color=[0 for i in range(n+1)]
b=True
def f(v,c):
    #頂点vに隣接する頂点全てを塗るあるいは判定する
    color[v] = c
    for i in range(len(l[v])):
        if color[ l[v][i] ] == c:
            return False
        elif color[ l[v][i] ] == 0 and not f(l[v][i],-c):
            #(g[v][i]がまだ塗られていない　かつ　そこを-cで塗っても問題ない) ではないなら
            return False
    return True
b=f(1,1)
if not b:
  print(-1)
else:
  inf=10**10
  d=[[inf for i in range(n+1)] for j in range(n+1)]
  for i in range(n+1):
    for j in l[i]:
      d[i][j]=1
  for k in range(n+1):
    for j in range(1,n+1):
      for i in range(1,n+1):
        d[i][j]=min(d[i][j],d[i][k]+d[k][j])
  max=0
  for i in range(1,n+1):
    for j in range(1,n+1):
      if i==j:
        pass
      elif d[i][j]>max:
        max=d[i][j]
  print(max+1)

Measured memory_bytes: 43116
/******************************************
*    AUTHOR:         CHIRAG AGARWAL       *
*    INSTITUITION:   BITS PILANI, PILANI  *
******************************************/
#include <bits/stdc++.h>
using namespace std;
 
typedef long long LL; 
typedef long double LD;

int main() 
{
	string s;
	cin>>s;
	string tmp,prev;
	int ans=s.length()-1;
	for(int j=0;j<26;j++)
	{
		int cur=s.length();
		int moves=0;
		tmp=s;
		while(true)
		{	
			prev=tmp;
			tmp="";
			int flg=0;
			for(int i=0;i<prev.size();i++)
			{
				if(prev[i]!=('a'+j))
				{
					flg=1;
					break;
				}
			}
			if(flg==0)
			{
				break;
			}	
			moves++;

			if(prev.size()==1)
			{
				break;
			}
				for(int i=0;i<(cur-1);i++)
				{
					if(prev[i]==('a'+j)||prev[i+1]==('a'+j))
					{
						tmp+=('a'+j);
					}
					else
					{
						tmp+=prev[i];
					}
				}
			cur--;
		}	
		ans=min(ans,moves);
	}		
	printf("%d\n",ans);
	return 0;
}

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

typedef long long int lli;
typedef pair<int, int> ii;

const int MOD = 2019;
int l, r;

int main() {
	ios_base::sync_with_stdio(false);

	cin >> l >> r;
	r -= MOD*(l/MOD);
	l -= MOD*(l/MOD);

	if(r - l > 2019) cout << 0 << endl;
	else {

	int mini = MOD;

	for(int i = l; i<=r; i++) {
		for(int j = i+1; j<=r; j++) {
			if((i*j)%MOD < mini) mini = ((i*j)%MOD);
		}
	}
	
	cout << mini << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N,M = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
bc = [tuple(int(i) for i in input().split()) for _ in range(M)]

A.sort()
bc.sort(key=lambda t: t[1], reverse=True)

index = 0
count = 0
for i in range(N):
    if index >= M or A[i] >= bc[index][1]:
        break
    A[i] = bc[index][1]
    count += 1
    if bc[index][0] <= count:
        index += 1
        count = 0

print(sum(A))


Measured memory_bytes: 79384
package main

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

func main() {
	AB := nextInt()
	BC := nextInt()
	//CA := nextInt()

	fmt.Println(AB * BC / 2)
}

// https://atcoder.jp/contests/abc125/submissions/5181045
func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}

func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}

func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}

func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}

func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

var nextReader func() []byte

func init() {
	nextReader = newScanner()
}

func newScanner() func() []byte {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() []byte {
		r.Scan()
		return r.Bytes()
	}
}

func nextBytes() []byte {
	return nextReader()
}

func nextString() string {
	return string(nextReader())
}

func nextInt64() int64 {
	v, _ := strconv.ParseInt(string(nextReader()), 10, 64)
	return v
}

func nextInt() int {
	v, _ := strconv.Atoi(string(nextReader()))
	return v
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(string(nextReader()), 64)
	return f
}


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

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

  if (N/1000==N%1000/100&&N/1000==N%1000%100/10){
    cout << "Yes" << endl;
  }
  else if (N%1000/100==N%1000%100/10&&N%1000/100==N%1000%100%10){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}



Measured memory_bytes: 256
# B

def bisearch(f, n):
    l = 0
    r = n
    fl = f(l)
    fr = f(r)
    while l <= r:
        m = (l + r) // 2
        fm = f(m)
        #print l,m,r,fl,fm,fr,n
        if fm == n:
            return m
        elif fm > n:
            r = m - 1
            fr = f(r)
        else:
            l = m + 1
            fl = f(l)

def try_square_root(n2):
    return bisearch(lambda n:n*n, n2)

a, b = input().split()

c = int(a + b)

if try_square_root(c) != None:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3316
function Main(input) {
  input = input.split("\n");
  var n = parseInt(input[0]);
  c = new Array(n-1).fill(0);
  s = new Array(n-1).fill(0);
  f = new Array(n-1).fill(0);
  for(i=0;i<n-1;i++){
    c[i]=parseInt(input[i+1].split(" ")[0]);
    s[i]=parseInt(input[i+1].split(" ")[1]);
    f[i]=parseInt(input[i+1].split(" ")[2]);
  }
  t = new Array(n).fill(0);
  for(i=1;i<n-1;i++){
    for(j=0;j<i;j++){
      if(s[i]>=s[j]+c[i-1]){
        s[j]=s[i];
      }else{
        s[j]=s[i]+Math.ceil(((s[j]+c[i-1])-s[i])/f[i])*f[i];
      }
    }
  }
  var ans ="";
  for(i=0;i<n-1;i++){
    s[i]+=c[c.length-1];
    ans+=s[i]+"\n";
  }
  ans=ans+"0";
  console.log('%s', ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 9788
/*
─────────────────────
───────────████████──
──────────███▄███████
──────────███████████
──────────███████████
──────────██████─────
──────────█████████──
█───────███████──────
██────████████████───
███──████AJ████──█───
███████████████──────
███████████████──────
─█████████████───────
──███████████────────
────████████─────────
─────███──██─────────
─────██────█─────────
─────█─────█─────────
─────██────██────────
─────────────────────
*/

#include<bits/stdc++.h>
using namespace std;

#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long

int N;
vector<ll> b;
vector<ll> h;
// ll result = 0;
// const int maxN = 1e5 + 1;

ll solve() {
	vector<ll> dp(N);
	map<ll, ll> map; //height to dp
	dp[0] = b[0];
	map[h[0]] = b[0];
	ll ans = dp[0];
	// cout << N << endl;
	for (int i = 1; i < N; i++) {
		// cout << i << endl;
		dp[i] = b[i];
		auto it = map.lower_bound(h[i] + 1);
		if (it != map.begin()) {
			// cout << "Entered\n";
			it--;
			// dp[i] = max(dp[i], )
			dp[i] += it->second;
		}
		map[h[i]] = dp[i];
		it = map.upper_bound(h[i]);
		// it++;
		while (it != map.end() && it->second <= dp[i]) {
			// cout << "Deleted\n";
			auto temp = it;
			temp++;
			map.erase(it);
			it = temp;
		}
		// cout << dp[i] << endl;
		ans = max(ans, dp[i]);
		// printf("dp[i]: %lld, ans: %lld\n", dp[i], ans);
	}
	// for (auto x : dp) {
	// 	cout << x << " ";
	// }
	// cout << endl;
	return ans;
}

int main() {
	cin >> N;
	b = vector<ll>(N);
	h = vector<ll>(N);
	for (int i = 0; i < N; i++) {
		cin >> h[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> b[i];
	}
	ll res = solve();
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 20364
A, B, C = gets.chomp.split.map(&:to_s)

puts [(A + B).to_i + C.to_i,
	  (B + A).to_i + C.to_i,
      (A + C).to_i + B.to_i,
      (C + A).to_i + B.to_i,
      (B + C).to_i + A.to_i,
      (C + B).to_i + A.to_i].max

Measured memory_bytes: 1788
//Created by Aminul on 8/22/2020.

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

import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = in.nextInt();
        long res = 0, max = 0;
        for (int i = 0; i < n; i++) {
            long x = in.nextInt();
            if (x < max) {
                res += max - x;
                x = max;
            }
            max = max(max, x);
        }

        pw.println(res);

        pw.close();
    }

    static void debug(Object... obj) {
        System.err.println(Arrays.deepToString(obj));
    }
}

Measured memory_bytes: 48552
using System;

namespace ABC_167_A_Csharp_ver
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();
            string T = Console.ReadLine();
            int S_count = S.Length;
            int T_count = T.Length;
            string s = S.Substring(0, S_count);
            string t = T.Substring(0, T_count-1);
            if (s == t)
            {
                Console.WriteLine("Yes");
            }
            else Console.WriteLine("No");
        }
    }
}


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

using namespace std;

typedef long long ll;

#define sz(x) ((int)(x).size())
#define in(x) int x;cin>>x
#define inn(x, y) int x,y;cin>>x>>y
#define innn(x, y, z) int x,y,z;cin>>x>>y>>z
#define bit(n) (1<<(n))

#define out(x) cout<<(x)<<endl;
#define outt(x,y) cout<<(x)<<" "<<(y)<<endl;
#define err(x) cerr<<(x)<<endl;
#define errr(x,y) cerr<<(x)<<" "<<(y)<<endl;
#define errrr(x,y,z) cerr<<(x)<<" "<<(y)<<" "<<(z)<<endl;

#define rep(i,n) for (int i=0;i<(n);i++)
#define repp(i,n) for (int i=1;i<=(n);i++)
#define reppp(j, i, n) for (int j=i+1; j<n; j++)

#define lim5 200020
#define lim9 1000000002

#define deg(rad) (((rad)/2/M_PI)*360)
#define mid(min, max) ((min + max) / 2)

int main() {
	string s;
	cin >> s;
	string c = "coffee";

	if (s[2] == s[3] && s[4] == s[5]) {
		out("Yes");
		return 0;
	}

	out("No");
	return 0;
}


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

using ll = long long;

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

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

    sort(h.begin(), h.end());

    ll ans = 1e10;
    for (int i = 0; i <= n-k; i++) {
        ll hdiff = h[i+k-1] - h[i];
        ans = min(ans, hdiff);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <math.h>
#include <map>

typedef long long LL;

const long long INF = 1LL << 60;

using namespace std;

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

    vector<LL> A(N);

    for (int i = 0; i < N; i++)
    {
        cin >> A.at(i);
    }

    sort(A.begin(), A.end());

    if (A.at(0) == 0)
    {
        cout << 0 << endl;
        return 0;
    }

    LL ans = 1;
    while (N > 0)
    {
        //if (ans > 1e18)  これだとifの中に入らないになる
        if (ans > 1000000000000000000 / A.at(N - 1))
        {
            cout << -1 << endl;
            return 0;
        }
        else
        {
            ans *= A.at(N - 1);
        }

        N--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3680
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include <fstream>
#include <time.h>
#include <iterator>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;

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


int A[620][620],cum[620][620];
string S[303];
int H, W,N,ret;
void solve() {
	//横方向に累積和をとる
	REP(i, N) {
		cum[i][0] = 0;
		REP(j, N) {
			cum[i][j + 1] = cum[i][j] + A[i][j];
		}
	}

	//横方向で二点を固定する
	REP(x, N) {
		REP(y, N) {
			if (A[x][y] == 0)continue;
			FOR(y2, y + 1, N) {
				if (A[x][y2] == 0)continue;
				int d = y2 - y;
				if (x + d < N) {
					ret += cum[x+d][y2] - cum[x+d][y];
				}
			}
		}
	}
}
int A2[620][620];
//90度回転
void rot() {
	REP(i, N) {
		REP(j, N) {
			A2[i][j] = A[j][N - 1 - i];
		}
	}
	REP(i, N) {
		REP(j, N) {
			A[i][j] = A2[i][j];
		}
	}
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> H >> W;
	REP(i, H) {
		cin >> S[i];
	}
	REP(i, H) {
		REP(j, W) {
			if (S[i][j] == '#') {
				int x = i + j;
				int y = i - j - 1 + W;
				A[x][y] = 1;
			}
		}
	}
	N = H + W;
	/*REP(i, N) {
		REP(j, N) {
			pe(A[i][j]);
		}cout << endl;
	}*/

	ret = 0;
	solve(); rot();
	solve(); rot();
	solve(); rot();
	solve();
	print(ret);
}


Measured memory_bytes: 9216
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
int a,b,c,d;
cin>>a>>b>>c>>d;
int a1=a+b;
int a2=c+d;
if(a1>a2)
cout<<"Left";
else if(a1==a2)
cout<<"Balanced";
else
cout<<"Right";

return 0;  
}

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

int main()
{
  int A, B;
  cin >> A >> B;

  int n = 0;
  int plugs = 1;
  while(true)
  {
    if(plugs >= B)
    {
      cout << n << endl;
      break;
    }
    plugs += A - 1;
    n++;
  }
}

Measured memory_bytes: 3548
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int x = (int)(N / 2) + N%2;
		System.out.println(x);
	}

}


Measured memory_bytes: 23252
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0088
{
    public class Program
    {
        public static void Main(string[] args)
        {
            while (true)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line)) return;

                string bit = "";
                foreach (var item in line) bit += toBit[item];
                bit += new string('0', (5 - bit.Length % 5) % 5);

                string res = "";
                for (int i = 0 ; i < bit.Length ; i += 5) res += toChar[Convert.ToInt32(bit.Substring(i, 5), 2)];

                Console.WriteLine(res);
            }
        }

        static readonly Dictionary<char, string> toBit = new Dictionary<char, string>()
        {
            {' ',"101" },
            {'\'',"000000" },
            {',',"000011" },
            {'-',"10010001" },
            {'.',"010001" },
            {'?',"000001" },
            {'A',"100101" },
            {'B',"10011010" },
            {'C',"0101" },
            {'D',"0001" },
            {'E',"110" },
            {'F',"01001" },
            {'G',"10011011" },
            {'H',"010000" },
            {'I',"0111" },
            {'J',"10011000" },
            {'K',"0110" },
            {'L',"00100" },
            {'M',"10011001" },
            {'N',"10011110" },
            {'O',"00101" },
            {'P',"111" },
            {'Q',"10011111" },
            {'R',"1000" },
            {'S',"00110" },
            {'T',"00111" },
            {'U',"10011100" },
            {'V',"10011101" },
            {'W',"000010" },
            {'X',"10010010" },
            {'Y',"10010011" },
            {'Z',"10010000" }
        };

        static readonly char[] toChar = new char[]
        {
            'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ','.',',','-','\'','?'
        };


        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 22168
n,k=map(int,input().split())

if k%2==1:
    c=int(n//k)
    print(c*c*c) 
else:
    c=int(n//(k/2))
    d=int(n//k)
    e=c-d
    print(e*e*e+d*d*d)  


Measured memory_bytes: 3188
//https://atcoder.jp/contests/abc122/tasks/abc122_b
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int max2(int a, int b){
  if(a>b) return a;
  else return b;
}

int main(){

  string S;
  cin >> S;
  int ans = 0;
  int len = S.length();
  for(int i=0; i<len; i++){
    for(int j=i; j<len; j++){
      int count=0;
      for(int n=i; n<=j; n++){
        if(S[n]=='A'||S[n]=='T'||S[n]=='G'||S[n]=='C'){
          count++;
        }
      }
      if(count == j-i+1){
        ans = max2(ans,count);
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define pb                  push_back
#define mp                  make_pair

#define dd                  double
#define ll                  long long int

using namespace std;
#define pi                  pair<int,int>
#define pii                 pair< pair<int,int> ,int>


int solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c<<endl;


    return 0;
}

int main()
{
    solve();
    return 0;
}


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


int n,d,x,a;
int main(){
  cin>>n;
  cin>>d>>x;
  for(int i=0;i<n;i++){
    cin>>a;
    x++;
    x+=(d-1)/a;
  }
  cout<<x<<endl;
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int h,n,a,sum=0;
	scanf("%d%d",&h,&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a);
		sum+=a;
	}
	printf("%s",sum<h?"No\n":"Yes\n");
	return 0;
}

Measured memory_bytes: 128
N=int(input())#訪問すべき点の数
t=[0]*N
x=[0]*N
y=[0]*N

#各時刻に訪問すべき点の入力
for i in range(N):
    t[i],x[i],y[i]=map(int, input().split())

#初期位置と時間
x0=0
y0=0
t0=0


for i in range(N):
    #現在時刻と次の時間との差
    dt=t[i]-t0
    #現在位置と次の目標地点との距離
    d=abs(x0-x[i])+abs(y0-y[i])
    #距離が時間差よりも大きければ到達できないのでNO
    if dt-d<0:
        print("No")
        exit()
    #距離と時間差の偶奇が不一致なら到達できないのでNo
    if (dt-d)%2>0:
        print("No")
        exit()
    #初期位置を時刻tiのものに更新
    x0=x[i]
    y0=y[i]
    t0=t[i]

#上の条件をすべてクリアできていればYes
print("Yes")

Measured memory_bytes: 11636
n,m=map(int,input().split())
h=list(map(int,input().split()))
ng=set()
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    if h[a]<h[b]:
        ng.add(a)
    elif h[a]>h[b]:
        ng.add(b)
    else:
        ng.add(a)
        ng.add(b)
print(n-len(ng))

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

#define ll long long
#define str string
#define INF (1e9)

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


ll V[10000000] = {},m = 0,a = 0,b = 0,n = 0, k = 0,sum = 0;; 
ll G[10000000] = {};
str S,Sa;
bool ans = false;

int findSumOfDigits(int n) {
	int sum = 0;
	while (n > 0) {
		
		sum += n%10;
		n /= 10;
	}
	return sum;
}

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
		//Code Line
cin >> n >> m;
for(int i = 0;i < n;i++){
	cin >> sum;
	for(int j = 0;j < sum;j++){
		cin >> b;
		V[b] += 1;
	}
}
for(int i = 0;i < 31;i++){
if(V[i] >= n)k++;
}
cout << k << endl;

		//Code Line
return 0; 
}


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


using namespace std;

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

  if(c-a-b <= 0){
    cout << "No" << endl;
    return 0;
  }
  int64_t A,B;

  A = 4*a*b;
  
  B = (c-a-b)*(c-a-b);
  if (A < B){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef long double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (int)x.size()
#define f first
#define s second
const int MAXN=266100;
const int MAXK=19;
const int INF = 1e9;
int N,Q,a,b,c,d,e,f;
int H = 9;

vpi V[MAXN];
pi T[MAXN];
vpi queries[MAXN];
int ans[MAXN];
vpi tmp;

inline void fill(int i){
	int par = i/2;
	if (i>=(1<<H) && par<(1<<H))par=0;
	// cerr<<"Node "<<i<<" parent "<<par<<'\n';
	vpi A,B,C;
	pi cw = T[i];
	// cerr<<"I "<<cw.f<<' '<<cw.s<<'\n';
	for (auto t:V[par]){
		B.pb(mp(t.f+cw.f,t.s+cw.s));
		A.pb(t.f,t.s);
	}
	reverse(ALL(A));
	reverse(ALL(B));
	while(SZ(A)&&SZ(B)){
		if(A.back().f < B.back().f){
			C.pb(A.back());
			A.pop_back();
		}else{
			C.pb(B.back());
			B.pop_back();
		}
	}
	while(SZ(A)){
		C.pb(A.back());
		A.pop_back();
	}
	while(SZ(B)){
		C.pb(B.back());
		B.pop_back();
	}
	// for (auto i:C){
	// 	cerr<<i.f<<' '<<i.s<<'\n';
	// }
	for (auto t : C){
		if(SZ(V[i])){
			if(V[i].back().f == t.f){
				V[i].back().s = max(V[i].back().s, t.s);
				continue;
			}else if(V[i].back().s >= t.s){
				continue;
			}
		}
		V[i].pb(t);
	}
}

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cout.tie(0);
    cin>>N;
    int layers = 0;
    int r = N;
    while(r){
    	r/=2;
    	layers++;
    }
    H=min(H,layers);
   	for(int i=1;i<=N;++i){
   		cin>>a>>b;
   		T[i]=mp(b,a);
   	}
   	cin>>Q;
   	for(int i=0;i<Q;++i){
   		ans[i]=-1;
   		cin>>a>>b;
   		queries[a].pb(b,i);
   	}
   	V[0].pb(0,0);
   	c=1;
   	for (int i=1;i<=N;++i){
   		if (i<(1<<H)){
   			fill(i);
   			// for (auto x:V[i])cerr<<x.f<<' '<<x.s<<'\n';
   			while(SZ(queries[i])){
   				int l = queries[i].back().f;
   				int t = queries[i].back().s;
   				queries[i].pop_back();
   				pair<int,int> x = *( --lb(ALL(V[i]), mp(l, INF)) );
   				ans[t]=x.s;
   			}
   		}else{
   			fill(i);
   			int par = i;
   			while(par>=(1<<H))par/=2;
   			// cerr<<i<<' '<<par<<'\n';
   			for (auto it : queries[i]){
   				int l = it.f;
   				int t = it.s;
   				int ind = SZ(V[par])-1;
   				for (int x=0;x<SZ(V[i]);++x){
   					while(ind>-1&&V[par][ind].f+V[i][x].f > l){
   						--ind;
   					}
   					if(ind == -1)break;
   					ans[t] = max(ans[t], V[par][ind].s+V[i][x].s);
   				}
   			}
   		}
   	}

   	for (int i=0;i<Q;++i){
   		cout<<ans[i]<<'\n';
   	}
}

Measured memory_bytes: 725944
#include<bits/stdc++.h>
using namespace std;
#define fio ios_base::sync_with_stdio(false); cin.tie(NULL);
#define M 1000000007
#define ll long long
#define db double
#define pb push_back
#define F first
#define S second
#define vl vector<ll>
#define vvl vector<vl>
#define pii pair<int,int>
#define mkp make_pair

int main()
{
	ll n;
	cin >> n;
	ll a[n],dp[n];
	for(ll i=0;i<n;i++) cin >> a[i];
	
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(ll i=2;i<n;i++)
	{
		dp[i]=min(dp[i-2]+abs(a[i]-a[i-2]), dp[i-1]+abs(a[i]-a[i-1]) );
	}
	cout << dp[n-1] << endl;
}

Measured memory_bytes: 1792
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	int num, ans = 0, len;
	string name, sig[128];
	bool end;
	
	cin >> num;
	cin >> name;
	for(int i = 0; i < num; i++)
	{
		cin >> sig[i];
	}

	for(int i = 0; i < num; i++)
	{
		for(int j = 0; j < sig[i].size(); j++)
		{
			if( name[0] == sig[i][j] )
			{
				for(int k = j; k < sig[i].size(); k++)
				{
					if( name[1] == sig[i][k] )
					{
						int p = 2;
						len = k - j;

						for(int l = k + len; l < sig[i].size(); l += len, p++)
						{
							if(sig[i][l] == name[p])
							{
								if(p >= name.size()-1)
								{
									ans++;
									goto next;
								}
							}
							else
							{
								break;
							}
						}
					}
				}
			}
		}
next:;
	}
	cout << ans << endl;
}

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

using namespace std;

int main() {
  int A, B, H, M;
  cin >> A >> B >> H >> M;
  double s = 2 * M_PI * H / 12 + 2 * M_PI / 12 * M / 60;
  double t = 2 * M_PI * M / 60;
  double d = abs(s - t);
  if (d > M_PI) d = 2 * M_PI - d;
  double ans = sqrt(A * A + B * B - 2 * A * B * cos(d));
  cout << fixed << setprecision(15);
  cout << ans << endl;

  return 0;
}
/* vim:set fdm=marker: */


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

int main(void){
  int n,i;
  double a,ans = 0.0;
  cin >> n;
  for(i=0; i<n; i++){
    cin >> a;
    ans += 1/a;
  }
  cout << fixed;
  cout << setprecision(10) << 1/ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
int n,i;
scanf("%d",&n);
int a[n],cnt=0;
for(i=1;i<=n;i++) scanf("%d",&a[i]);
for(i=1;i<=n;i+=2){
    if(a[i]%2!=0) cnt++;
}
printf("%d",cnt);

    return 0;
}

Measured memory_bytes: 1736
I=lambda:list(map(int,input().split()))
n,m=I()
s=eval('I(),'*m)
p=I()
a=0
r=range
for i in r(1<<n):
 c=[0]*m
 for j in r(n):
  for k in r(m):c[k]+=i>>j&(j+1in s[k][1:])
 a+=all(j==i%2for i,j in zip(c,p))
print(a)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = sc.nextInt();
    int[] w = new int[n];
    int l = 0;
    int r = 0;
    int ans = Integer.MAX_VALUE;

    for (int i = 0; i < n; i++) {
      w[i] = sc.nextInt();
      r += w[i];
    }

    r -= w[0];
    l += w[0];

    for (int i = 1; i < n; i++) {
      ans = Math.min(ans, Math.abs(l - r));
      r -= w[i];
      l += w[i];
    }

    System.out.println(ans);

  }
}

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

#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

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

int H,W;
int F[100][100];

int dfs(int y,int x){
    int ret=0;
    F[y][x]=0;
    rep(i,4){
        int ny=y+dy[i],nx=x+dx[i];
        if(ny<0||ny>=H||nx<0||nx>=W||!F[ny][nx])continue;
        chmax(ret,dfs(ny,nx));
    }
    F[y][x]=1;
    return ret+1;
}

signed main(){
    while(cin>>H>>W,H||W){
        rep(i,H)rep(j,W)cin>>F[i][j];
        int ma=0;
        rep(i,H)rep(j,H)if(F[i][j])chmax(ma,dfs(i,j));
        cout<<ma<<endl;
    }

    return 0;
}

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

int main() {
  char C;
  cin >> C;
  if (C=='a'||C=='e'||C=='i'||C=='o'||C=='u'){
    cout << "vowel" << endl;
  }
  else{
    cout << "consonant" << endl;
  }
    
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>
#include <iterator>
#include <regex>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

template <class T, template <class, class> class C, class charT = char>
void vdump(const C<T, allocator<T>> &v, const charT* delimiter = ", ",
           ostream &stream = cout) {
  copy(v.begin(), v.end(), ostream_iterator<T>(stream, delimiter));
  stream << endl;
}

int main() {
  ios::sync_with_stdio(false);
  int n;
  string a, b, c;
  cin >> n >> a >> b >> c;
  int ans = 0;
  REP(i,0,n) {
    string ith = {a[i], b[i], c[i]};
    sort(ith.begin(), ith.end());
    auto r = unique(ith.begin(), ith.end());
    ans += r - ith.begin() - 1;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    long N = Long.parseLong(sc.next());
    long ans = Long.MAX_VALUE;
    for(long i=1; i < Math.sqrt(N)+1; i++){
      if(N%i==0){
        ans = Math.min((N/i)+i-2,ans);
      }
    }
    System.out.print(ans);
    return;
  }
}



Measured memory_bytes: 23892
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
	int a, b;
	cin >> a >> b;
	for (int c = 1; c <= 3; ++c)
	{
		if ((a*b*c) % 2 != 0)
		{
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	return 0;
}

Measured memory_bytes: 256
"use strict";
function main(input) {
    const args = input.split("\n");
    const one = args[0].split(" ");
    const second = args[1].split(" ");

    const N = parseInt(one[0]);
    const M = parseInt(one[1]);

    let temp;
    let front;
    let end;
    let min = parseInt(second[0]);
    let max = parseInt(second[1]);

    for(let i = 2; i <= M; i++) {
        temp = args[i].split(" ");
        front = parseInt(temp[0]);
        end = parseInt(temp[1]);
        if (max < front || end < min) {
            min = 0;
            max = -1;
            break
        }
        if(min < front) {
            min = front;
        }
        if(end < max) {
            max = end;
        }
    }
    console.log(max - min + 1)

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 28976
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    int mod = 1000000007;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    long long sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        sum%=mod;
    }
    long long ans=0;
    for(int i=0;i<n;i++){
        sum-=a[i];
        if(sum<0)sum+=mod;
        ans+=(a[i]*sum);
        ans%=mod;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3984
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        int K = Integer.parseInt(sc.next());
        int Q = Integer.parseInt(sc.next());

        int[] point = new int[N];
        for (int i=0;i<N;i++) {
            point[i] = K-Q;
        }
        for (int i=0;i<Q;i++) {
            int A = Integer.parseInt(sc.next())-1;
            point[A]++;
        }
        for (int i=0;i<N;i++) {
            if (point[i]<=0) {
                System.out.println("No");
            } else {
                System.out.println("Yes");
            }
        }
    }
}

Measured memory_bytes: 66664
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <list>
#include <cmath>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const int INF = 1 << 29;
const LL MOD = 100000;
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(), (c).end()

struct edge{ LL to, cost; edge(int t, LL c) :to(t), cost(c){} };

int dxk[] = { 1, 1, 1, 0, -1, 0 };
int dxg[] = { 0, 1, 0, -1, -1, -1 };
int dy[] = { -1, 0, 1, 1, 0, -1 };

int bitcount(int a)
{
	int ret = 0;
	while (a != 0) { ret++; a = (a - 1) & a; }
	return ret;
}

int main()
{
	int h, w;
	while (cin >> h >> w && h)
	{
		vector<int> cols(w);
		rep(i, h) rep(j, w)
		{
			int t; cin >> t;
			cols[j] = (cols[j] << 1) | t;
		}
		int ans = 0;
		for (int i = 0; i < (1 << h); i++)
		{
			int tmp = 0;
			rep(j, w) tmp += max(h - bitcount(cols[j] ^ i), bitcount(cols[j] ^ i));
			ans = max(tmp, ans);
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
#define IOS {ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define endl "\n"
#define float long double
#define int long long int
#define f(i, a, b) for(int i=a; i<b; i++)
#define fb(i, a, b) for(int i=a; i>=b; i--)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fi first
#define se second
#define vi vector <int>
#define pi pair <int, int>
#define LB lower_bound
#define UB upper_bound
#define g(t, n) get<n>(t)
#define fp(x, y) fixed<<setprecision(y)<<x
#define PI 3.141592653589793238462643383279502884
using namespace std;

const int M = (int)2e5+5;
const int mod = (int)1e9+7;

void solve()
{
    int n;
    cin>>n;
    cout<<((n >= 30) ? "Yes" : "No");
}

int32_t main()
{
    IOS
    int t = 1;
    // cin>>t;
    f(tno, 1, t+1)
    {
        // cout<<"Case #"<<tno<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3608
#include <cstdlib>
#include <iostream>
#include <typeinfo>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

  vector<int> nums;
  int now = 1;
  int cnt = 0;
  for (int i = 0; i < n; i++)
  {
    if (s.at(i) == (char)('0' + now))
      cnt++;
    else
    {
      nums.push_back(cnt);
      now = 1 - now;
      cnt = 1;
    }
  }
  if (cnt != 0)
  {
    nums.push_back(cnt);
  }
  if (nums.size() % 2 == 0)
    nums.push_back(0);

  int add = 2 * k + 1;

  int ans = 0;

  int left = 0;
  int right = 0;
  int temp = 0;

  for (int i = 0; i < nums.size();i+=2){

    int nextLeft = i;
    int nextRight = min(i + add, (int)nums.size());

    //左端を移動する
    while(nextLeft>left){
      temp -= nums.at(left);
      left++;
    }

    //右端を移動する
    while(nextRight>right){
      temp += nums.at(right);
      right++;
    }

    ans = max(temp, ans);
  }

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

Measured memory_bytes: 1020
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, t = LI()
    print(b * (t // a))
    return

#B
def B():
    n = II()
    v = LI()
    c = LI()
    ans = 0
    for i in range(n):
        if v[i] > c[i]:
            ans += v[i] - c[i]
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38384
#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++) {
    string s = to_string(i);
    int total = 0;
    int t = i;
    for (int j = 0; j < 5; j++) {
      total += t % 10;
      t /= 10;
    }
    if (a <= total && total <= b) {
      result += i;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef unsigned int ll;
typedef int ull;
#define LONGMAX 1e18
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define endl "\n"
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first	
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define INF 1e9
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
ll powe(ll x,ll y){ll res=1;while(y>0){if(y&1)res=res*x;y=y>>1;x=x*x;}return res;}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}
void ceilsearch(ll ar[],ll low,ll high,ll x,ll &y){ll mid=(low+high)/2;if(low>high)return;if(ar[mid]>=x){y=mid;ceilsearch(ar,low,mid-1,x,y);}else{ceilsearch(ar,mid+1,high,x,y);}}
int main()
{
	fastio();
    ll N;
    cin>>N;
    ll ar[N];
    cn(ar,N);
    ll sum=0;
    for(ll i=0;i<N;i++)
        sum+=ar[i];
    sum/=N;
    ll ans1=0;
    ll ans2=0;
    ll ans3=0;
    for(ll i=0;i<N;i++)
    {
        ans1=ans1+(ar[i]-sum)*(ar[i]-sum);
    }
    for(ll i=0;i<N;i++)
    {
        ans2=ans2+(ar[i]-sum-1)*(ar[i]-sum-1);
    }
    for(ll i=0;i<N;i++)
    {
        ans3=ans3+(ar[i]-sum+1)*(ar[i]-sum+1);
    }
    cout<<min({ans1,ans2,ans3})<<endl;
}//*-A/BC-/AKL

Measured memory_bytes: 256