akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

template<class T> void swap(T &a, T &b ){
    T temp;
    temp = a;
    a = b;
    b = temp;   
}

int main(){
    int N;
    int temp;
    int *d;
    int i,j;
    ULL ans;

    cin >> N;
    d = new int[N];
    for(i=0;i<N;i++){
        cin >> d[i];
    }
    ans = 0;
    for(i=0;i<N-1;i++){
        for(j=i+1;j<N;j++){
            ans += d[i] * d[j];
        }

    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#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 pair<int,int> pii;

int main(void) {
  int i,j;
  int n,l;
  cin>>n>>l;
  vector<string> s(n);
  rep(i,n)cin>>s[i];
  sort(all(s));
  rep(i,n)
    cout<<s[i];
  cout<<endl;


}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend() 
#define pb(x) push_back(x)

using namespace std;
using ll=long long;

long mod=1e9+7;

ll N,Q;

struct Unionfind{
  vector<ll> par,siz;
  //Constructor
  Unionfind(ll sz_):par(sz_),siz(sz_,1){
    for(ll i=0;i<sz_;i++)par[i]=i;
  }
  
  ll root(ll x){
    return par[x]==x?x:
    par[x]=root(par[x]);
  }

  bool same(ll x,ll y){
    return root(x)==root(y);
  }

  void unite(ll x,ll y){
    x=root(x);
    y=root(y);
    if(x==y)return;
    if(siz[x]<siz[y])swap(x,y);
    siz[x]+=siz[y];
    par[y]=x;
  }

  ll size(ll x){
    return siz[root(x)];
  }

};

int main() {
  ll n,a,b,c,d,e;
  cin>>n>>a>>b>>c>>d>>e;
  ll m=min(min(min(a,b),min(c,d)),e);
  ll ans=((n+m-1)/m)+4;
  cout<<ans;
}



Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	basicIO "io"
	"os"
	"strconv"
)

func main() {
	protagonist(os.Stdin, os.Stdout)
}

func protagonist(r basicIO.Reader, w basicIO.Writer) {
	io := NewIO(r, w)
	S := io.nextString()
	for i, v := range S {
		if v == 'U' || v == 'D' {
			continue
		}
		if (i+1)%2 == 0 {
			if v == 'L' {
				continue
			}
		} else {
			if v == 'R' {
				continue
			}
		}
		io.PutString("No")
		return
	}
	io.PutString("Yes")
}

type IO struct {
	Scanner *bufio.Scanner
	Writer  basicIO.Writer
}

func NewIO(r basicIO.Reader, w basicIO.Writer) *IO {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &IO{
		Scanner: s,
		Writer:  w,
	}
}

func (io *IO) nextString() string {
	io.Scanner.Scan()
	return io.Scanner.Text()
}

func (io *IO) nextInt() (int, error) {
	io.Scanner.Scan()
	i, err := strconv.Atoi(io.Scanner.Text())
	return i, err
}

func (io *IO) PutInt(v int) {
	fmt.Fprintf(io.Writer, "%d\n", v)
}

func (io *IO) PutString(s string) {
	fmt.Fprintf(io.Writer, "%s\n", s)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int A, B;
    cin >> A >> B;
    int res = 0;
    for (int i = A; i <= B; i++) {
      string s = to_string(i);
      string r = s;
      reverse(r.begin(), r.end());
      if (s == r) res++;
    }
    cout << res << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
    int X;
    cin >> X;
    if ((X == 7)
      ||(X == 5)
      ||(X == 3))
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args)throws Exception {
    	InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

    	int i = 1;
    	while(true){
    		int x = Integer.parseInt(br.readLine());
    		 if(x == 0){
    			 break;
    		 }
    		 System.out.println("Case" + " " + i + ":" + " " + x);
    		 i++;
    	}
    }
}

Measured memory_bytes: 31276
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int inf = 1012345678;
struct edge {
	int to, cap, rev, id;
};
void add_edge(int a, int b, int id, vector<vector<edge> > &G) {
	G[a].push_back(edge{ b, 1, int(G[b].size()), id });
	G[b].push_back(edge{ a, 0, int(G[a].size()) - 1, id });
}
int find_augment(int pos, int tar, int curmax, vector<vector<edge> > &G, vector<bool> &vis) {
	if (pos == tar) return curmax;
	vis[pos] = true;
	for (edge &e : G[pos]) {
		if (vis[e.to] || e.cap == 0) continue;
		int res = find_augment(e.to, tar, min(curmax, e.cap), G, vis);
		if (res > 0) {
			e.cap -= res;
			G[e.to][e.rev].cap += res;
			return res;
		}
	}
	return 0;
}
int max_flow(int S, int T, vector<vector<edge> > &G) {
	int V = G.size();
	int ans = 0;
	while (true) {
		vector<bool> vis(V, false);
		int res = find_augment(S, T, inf, G, vis);
		if (res > 0) ans += res;
		else break;
	}
	return ans;
}
int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<edge> > G(N);
	vector<int> X(M), Y(M);
	for (int i = 0; i < M; ++i) {
		cin >> X[i] >> Y[i]; --X[i], --Y[i];
		add_edge(X[i], Y[i], i, G);
		add_edge(Y[i], X[i], i, G);
	}
	int S, T;
	cin >> S >> T; --S, --T;
	int ret = max_flow(S, T, G);
	cout << ret << endl;
	vector<int> elist;
	for (int i = 0; i < M; ++i) {
		int revused = 0;
		for (edge e : G[X[i]]) {
			if (e.to == Y[i]) revused += e.cap;
		}
		if (revused == 2) {
			elist.push_back(i);
		}
	}
	cout << elist.size() << endl;
	for (int i : elist) cout << i + 1 << endl;
	return 0;
}


Measured memory_bytes: 3296
n,m = map(int,input().split())
l = [1]*(n+1)
#kubaru_dp = [1]*n
 
for i in range(m):
    a = int(input())
    l[a] = 0
 
# l = [1,1,1,0,1,1,1]
for i in range(2,n+1):
    if l[i]==0:
        continue
    l[i] = (l[i-1]+l[i-2])%(10**9+7)
else:
    print(l[-1]%(10**9+7))

Measured memory_bytes: 6900
import java.io.PrintWriter
import java.lang.*
val pw = PrintWriter(System.out)
val MOD: Long = (1e+9 + 7).toLong()
data class Position(val h: Int, val w: Int, val cost: Int)
fun main(args: Array<String>) {
    val (h, w) = readListOfInt()
    val orgMaze = mutableListOf<MutableList<Char>>()
    val guard = (0 until w+2).map { '#' }.toMutableList()
    orgMaze.add(guard)
    for(i in 0 until h) {
        val m = read()
        orgMaze.add(("#" + m + "#").toMutableList())
    }
    orgMaze.add(guard)
    val directions = listOf(Pair(0, -1), Pair(0, 1), Pair(-1, 0), Pair(1, 0)) // left, right, down, top
    var ans = 0
    for(i in 1 until h+1) {
        for(j in 1 until w+1) {
            val que = Queue<Position>()
            if(orgMaze[i][j] == '.') {
                val maze = orgMaze.map { it.toMutableList() }
                que.push(Position(i, j, 0))
                var cost = 0
                while(!que.isEmpty()) {
                    val cpos = que.top()
                    maze[cpos.h][cpos.w] = '#'
                    que.pop()
                    directions.forEach { direction ->
                        val nh = direction.first + cpos.h
                        val nw = direction.second + cpos.w
                        cost = Math.max(cost, cpos.cost)
                        if(maze[nh][nw] == '.') {
                            que.push(Position(nh, nw, cpos.cost + 1))
                            maze[nh][nw] = '#'
                        }
                    }
                }
                ans = Math.max(ans, cost)
            }
        }
    }
    println(ans)
    pw.flush()
}
fun read() = readLine()!!
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun Float.format(digits: Int) = String.format("%.${digits}f", this)
fun println(value : Any) { pw.println(value) }
class Queue<T>(private var que: MutableList<T> = mutableListOf<T>()) {
    fun isEmpty() = que.isEmpty()
    fun top(): T = que.first()
    fun push(e: T) { que.add(e) }
    fun pop() { que = que.drop(1).toMutableList() }
}


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

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define reps(i, x) for (int i = 1; i <= (int)(x); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = ((int)(x)); i > 0; i--)

#define all(v) (v).begin(), (v).end()
#define sz(v) ((int)(v).size())
#define fill(v, x) memset((v), (x), sizeof(v))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))

#define dump(x) cerr << #x << " = " << (x) << endl;
#define vdump(v)          \
    for (auto &x : (v))   \
        cerr << x << " "; \
    cerr << endl

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

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

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

int main(void)
{
    int k;
    cin >> k;
    string s;
    cin >> s;
    if (sz(s) > k)
    {
        cout << s.substr(0, k) << "..." << endl;
    }
    else
    {
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define PI 3.14159265359
#define sz(c) (int)c.size()
#define len(c) (int)c.length()
#define hcf(a, b) __gcd(a, b)
#define all(c) c.begin(), c.end()
#define vint vector<int>
#define vll vector<ll>
#define vpint vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define tr(con, it) \
    for (auto it = con.begin(); it != con.end(); it++)
#define fr(it, a, b) \
    for (int it = (a); it < (b); it++)
#define present(con, ele) (con.find(ele) != con.end())
#define cpresent(con, ele) (find(all(con), ele) != con.end())
#define maximum(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
#define minimum(a, b, c) (a < b ? (a < c ? a : c) : (b < c ? b : c))
typedef long long ll;
typedef long double lf;
typedef unsigned long long lu;
const ll mod = 1e9 + 7;
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin >> s;
    unordered_map<int, int> M;
    reverse(all(s));
    int n = len(s), top = 0, ans = 0, x = 1;
    M[0]++;
    fr(i, 0, n)
    {
        top = (top + x * (s[i] - '0')) % 2019;
        if (present(M, top))
            ans += (M.find(top)->S);
        M[top]++;
        x = (10 * x) % 2019;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3752
N = int(input())
a = list(map(int, input().split()))
b = []
ans = []
for i in range(N):
    b.append(a[i]-i-1)
b.sort()
for i in range(N):
    ans.append(abs(a[i]-b[N//2]-i-1))
print(sum(ans))


Measured memory_bytes: 99948
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		Integer n = sc.nextInt();
		List<Integer> numbers = new ArrayList<Integer>(n);
		for(int i = 1; i <= n; i++) {
			numbers.add(sc.nextInt());
		}
		Collections.sort(numbers, Collections.reverseOrder());
		
		Integer a = 0;
		Integer b = 0;
		for(int i = 0; i < n; i ++) {
			if(i % 2 == 0) {
				a += numbers.get(i);
			} else {
				b += numbers.get(i);
			}
		}
		System.out.println(a - b);
	}
}

Measured memory_bytes: 21844
N = int(input())
A = [int(m) for m in input().split(" ")]
B = [int(b) for b in input().split(" ")]

Sum = 0

for i in range(N):
    ai = A[i]
    ai_1 = A[i+1]
    a = ai_1 + ai
    b = B[i]
    if a<=b:
        A[i+1]=0
        Sum+=a
    else:
        if (ai - b)>0:
            Sum+=(b)
        else:
            A[i+1] = a-b
            Sum+=b
print(Sum)

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

void solve() {
    ll N;
    cin >> N;
    vector<ll> A(N);
    for ( int i = 0; i < N; i++ ) {
        cin >> A[i];
    }
    vector<ll> L(N), R(N);
    ll ml = 0, mr = 0;
    for ( int i = 0; i < N; i++ ) {
        if ( ml < A[i] ) ml = A[i];
        L[i] = ml;
        if ( mr < A[N-1-i] ) mr = A[N-1-i];
        R[N-1-i] = mr;
    }
    for ( int i = 0; i < N; i++ ) {
        ll m = 0;
        if ( i > 0 ) m = max( m, L[i-1]);
        if ( i < N-1 ) m = max(m, R[i+1] );
        cout << m << "\n";
    }
    
}

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

Measured memory_bytes: 6272
//20190629
#include <iostream>
#include <vector>
using namespace std;

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

    if(s[0]==s[1] && s[2]==s[3] &&s[0]!=s[2]) cout << "Yes" << endl;
    else if(s[0]==s[2] && s[1]==s[3] && s[0]!=s[1]) cout << "Yes" << endl;
    else if(s[0]==s[3] && s[1]==s[2] && s[0]!=s[1]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>

#define nl '\n';

using namespace std;

int a, n;
string s;
char c;

int main(){

    cin >> n >> s;

    vector<int> v;

    for(int i = 0; i < s.length(); i++){
        a = s[i];
        v.push_back(a); 
    }


    for(int i = 0; i < v.size(); i++){
        v[i] = v[i] + n;
        if(v[i] > 90){
            v[i] = v[i] - 26;
        }
    }

    for(int i = 0; i < v.size(); i++){
        c = v[i];
        cout << c;
    }






}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out

// char** arr = new char*[r];
// for(long long i = 0; i < r; i++) arr[i] = new char[c];

Measured memory_bytes: 384
//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=next[i])
using namespace std;

const int INF=1<<30;

const int maxn=100000+10;
typedef long long ll;
ll x[maxn];

ll suf[maxn],pre[maxn];

int main()
{
	int n,k; cin>>n>>k;
	rep(i,1,n) scanf("%lld",x+i);
	
	int l=-1;
	rep(i,1,n) if(x[i]>0) {l=i;break;}
	
	if(l==-1)
	{
		cout<<x[n+1-k]*(-1)<<endl;
		return 0;
	}
	else if(l==1) 
	{
		cout<<x[k]<<endl;
		return 0;	
	}
	ll ans=0;
	
	if(l+k-1<=n)
	{
		ans=x[l+k-1];
	}
	else ans=1ll<<60;
	
	--l;
	
	int r=min(l+k-1,n),tmp=l;
	l=r-k+1;
	
	while(r>=tmp)
	{
		ans=min(ans,-x[l]+x[r]+min(-x[l],x[r]));
		if(--l==0) break;
		--r;
	}
	cout<<ans<<endl;
	
	
	return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
    string alphabet;
    cin >> alphabet;
    if(alphabet[0] >= 'A' && alphabet[0] <= 'Z')
    {
        cout << "A" << endl;
    }
    if(alphabet[0] >= 'a' && alphabet[0] <= 'z')
    {
        cout << "a" << endl;
    }
}

Measured memory_bytes: 3036
package main

import (
	"fmt"
	"sort"
)

func factorial(n int) int {
	if n == 1 {
		return 1
	}
	return factorial(n-1) * n
}

func makeCopy(nums []int) []int {
	return append([]int{}, nums...)
}

func permute(nums []int, ret *[][]int) {
	*ret = append(*ret, makeCopy(nums))

	n := len(nums)
	p := make([]int, n+1)
	for i := 0; i < n+1; i++ {
		p[i] = i
	}
	for i := 1; i < n; {
		p[i]--
		j := 0
		if i%2 == 1 {
			j = p[i]
		}

		nums[i], nums[j] = nums[j], nums[i]
		*ret = append(*ret, makeCopy(nums))
		for i = 1; p[i] == 0; i++ {
			p[i] = i
		}
	}
}

func permutation(nums []int) [][]int {
	n := factorial(len(nums))
	ret := make([][]int, 0, n)
	permute(nums, &ret)
	return ret
}

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

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

	nums := make([]int, n)
	for i := 1; i <= n; i++ {
		nums[i-1] = i
	}

	var pattern []string
	for _, v := range permutation(nums) {
		pattern = append(pattern, fmt.Sprint(v))
	}
	sort.Strings(pattern)

	var a, b int
	for i, v := range pattern {
		if v == fmt.Sprint(p) {
			a = i + 1
		}
		if v == fmt.Sprint(q) {
			b = i + 1
		}
	}
	fmt.Println(abs(a - b))
}


Measured memory_bytes: 11520
class UnionFind:
  N=0
  parent=None
  size=None
  def __init__(self,N):
    self.N=N
    self.parent=[i for i in range(self.N)]
    self.size=[1]*self.N
    
  def root(self,x):
    while x!=self.parent[x]:
      self.parent[x]=self.parent[self.parent[x]]
      x=self.parent[x]
    return x
  
  def same(self,x,y):
    return self.root(x)==self.root(y)
  
  def unite(self,x,y):
    x=self.root(x)
    y=self.root(y)
    if x==y:
      return
    if self.size[x]>self.size[y]:
      # 大きい方にくっつける
      self.parent[y]=x
      self.size[x]+=self.size[y]
    else:
      self.parent[x]=y
      self.size[y]+=self.size[x]
      
  def get_group_size(self,x):
    return self.size[self.root(x)]
  
  def get_roots(self):
    r=set()
    for i in range(self.N):
      r.add(self.root(i))
    return r
  
  def show_parent(self):
    print(self.parent)
    
  def show_size(self):
    print(self.size)
    
import sys
readline = sys.stdin.readline

N,M = map(int,readline().split())
UF = UnionFind(N)

for i in range(M):
  a,b = map(int,readline().split())
  UF.unite(a - 1, b - 1)
  
roots = UF.get_roots()
ans = 0
for r in roots:
  s = UF.get_group_size(r)
  if ans < s:
    ans = s
    
print(ans)

Measured memory_bytes: 35652
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define show(obj) {for(auto x:obj)cout<<x<<' ';cout<<endl;}
#define line "----------"
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	char c;
	cin >> c;
	if(c == 'A')cout << 'T' << endl;
	if(c == 'T')cout << 'A' << endl;
	if(c == 'C')cout << 'G' << endl;
	if(c == 'G')cout << 'C'	<< endl;
	return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)

int main()
{
    int n;cin >> n;
    double ans=0;
    REP(i,n){
        double x;
        string u;
        cin >> x >> u;
        if(u=="JPY"){
            ans += x;
        }else
            ans += x * 380000.0;
    }

    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int Num[3];
	int cnt = 0;

	cin >> Num[0] >> Num[1] >> Num[2];

	do {
		cnt = 0;
		for (int i = 0; i < 2; i++) {
			if (Num[i] > Num[i + 1]) {
				int tmp = Num[i];
				Num[i] = Num[i + 1];
				Num[i + 1] = tmp;
				cnt++;
			}
		}
	} while (cnt);

	cout << Num[0] << " " << Num[1] << " " << Num[2] << endl;

	return 0;
}

Measured memory_bytes: 1164
from collections import defaultdict
acs = defaultdict(int)

n, k, q = map(int, input().split())
for qq in range(q):
    a = int(input())
    acs[a] += 1
for a in range(1, n+1):
    score = k - (q - acs[a])
    if score <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 16144
#include<bits/stdc++.h>
#define LiangJiaJun main
using namespace std;
int h,w;
int c[14][14],a[204][204];
int ans=0;
int LiangJiaJun(){
    scanf("%d%d",&h,&w);
    for(int i=0;i<=9;i++)
        for(int j=0;j<=9;j++)scanf("%d",&c[i][j]);
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)scanf("%d",&a[i][j]);
    for(int k=0;k<=9;k++)
        for(int i=0;i<=9;i++)
            for(int j=0;j<=9;j++){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
            if(a[i][j]!=1&&a[i][j]!=-1){
                ans+=c[a[i][j]][1];
            }
    printf("%d\n",ans);
    return 0;
}



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

int main(){
	int a,b;	cin>>a>>b;
	if(a==1)a+=13;
	if(b==1)b+=13;

	if(a>b)cout<<"Alice"<<endl;
	else if(a==b)cout<<"Draw"<<endl;
	else cout<<"Bob"<<endl;

	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var nx = Add.ar;
        if (nx[1] == 1 || nx[1] == 2 * nx[0] - 1)
        {
            WriteLine("No"); return;
        }
        if (nx[0] == 2)
        {
            WriteLine($"Yes\n{string.Join("\n", Enumerable.Range(1, 3))}");
            return;
        }

        var res = Enumerable.Range(1, 2 * nx[0] - 1).ToArray();
        var ar = new int[4];
        if (nx[1] != 2)
            ar = new[] { nx[1] - 1, nx[1], nx[1] + 1, nx[1] - 2 };
        else
            ar = new[] { nx[1] + 1, nx[1], nx[1] - 1, nx[1] + 2 };
        for (var i = 0; i < 4; i++)
            if (ar[i] != res[nx[0]+i-2])
            {
                var index = res.ToList().IndexOf(ar[i]);
                var t = res[index];
                res[index] = res[nx[0] + i - 2];
                res[nx[0] + i - 2] = t;
            }
        
        WriteLine($"Yes\n{string.Join("\n", res)}");
    }
}

public class Add
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public  static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 34524
#include<bits/stdc++.h>
using namespace std;
#define ff(i,n) for(i=0;i<n;i++)
#define ll long long int
#define pb push_back
#define mp make_pair
ll power(ll x,ll y)
{
	if(y==0)
	return 1;
	ll h=power(x,y/2);
	h=(h*h);
	if(y%2==1)
	 return (x*h);
	else
	 return h;
}
vector<vector<ll> >adj(300000),store(2);		
void dfs(ll i,ll vis[],ll h)
{
	vis[i]=1;
	store[h].pb(i);
	ll j;
	for(j=0;j<adj[i].size();j++)
	{
		if(vis[adj[i][j]]==0)
		{
			dfs(adj[i][j],vis,1-h);
		}
	}
}
int main()
{
	ll t;
	t=1;
	while(t--)
	{
	    ll n,i,m,j;
		cin>>n;
		set<ll>set1;
		ff(i,n-1)
		{
			ll a,b;
			cin>>a>>b;
			adj[a].pb(b);
			adj[b].pb(a);
			set1.insert(i+1);
		}
		set1.insert(n);
		ll vis[n+1]={0};
		dfs(1,vis,0);
		ll check=min(store[0].size(),store[1].size());
		ll ff=n/3;
		vector<ll>temp1,temp2;
		ll ans[n+1];
		if(store[0].size()<=store[1].size())
		    {
				temp1=store[0];temp2=store[1];}
		else
			{
				temp1=store[1]; temp2=store[0];}				
		if(check<=ff)
		{
			ll c=0;
			for(i=3;i<=n;i+=3)
			{
				ans[temp1[c++]]=i;
				set1.erase(i);
				if(c==temp1.size())
					break;  	
			}	   
			c=0;
			for(i=1;i<=n;i++)
			{
			    if(set1.find(i)!=set1.end())
					ans[temp2[c++]]=i;	
			}	    
		}
		else
		{
			ll a=0,b=0;
			for(i=1;i<=n;i+=3)
				ans[temp1[a++]]=i;
			for(i=2;i<=n;i+=3)
			    ans[temp2[b++]]=i;
			for(i=3;i<=n;i+=3)
			{
			    if(a<temp1.size())
				  ans[temp1[a++]]=i;
				else if(b<temp2.size())
				  ans[temp2[b++]]=i;  	
			}    
		}
		for(i=1;i<=n;i++)
			cout<<ans[i]<<" ";  	
	}
    return 0;
}

Measured memory_bytes: 32872
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
BC = [list(map(int, input().split())) for _ in range(M)]
BC.sort(key=lambda x:x[1], reverse=True)
 
ans = 0
b,c = BC.pop(0)
for i,a in enumerate(A):
    if b>=1:
        if c > a:
            ans += c
            b -= 1
        else:
            ans += a
    if b<=0:
        if len(BC)==0:
            ans += sum(A[i+1:])
            break
        else:
            b,c = BC.pop(0)
 
print(ans)

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

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

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

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};

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

    int N; cin >> N;
    vector<int> T(N);
    int sum = 0;
    rep(i, N) {
        cin >> T[i];
        sum += T[i];
    }
    int M; cin >> M;
    rep(i, M) {
        int P, X;
        cin >> P >> X;
        P--;
        cout << sum - (T[P] - X) << endl;
    }
}



Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

#define NUM 1100000

using namespace std;

int table[NUM];

void func(int n,int budget){

	int tmp,max_prime = 0,food[n],index = 0;

	bool checkTable[budget+1],FLG;

	for(int i = 0; i < budget+1;i++)checkTable[i] = false;

	checkTable[0] = true;

	for(int i = 0; i < n; i++){
		scanf("%d",&tmp);
		FLG = true;

		//??¢?????????????????°???????¢??????????
		for(int loop = 0; loop < index;loop++){
			if(food[loop] == tmp){
				FLG = false;
				break;
			}
		}

		if(FLG == true && tmp <= budget){
			food[index++] = tmp;

			for(int k = 1; k <= budget; k++){
				if((k%tmp == 0) || (k >= tmp && checkTable[k-tmp] == true)){
					checkTable[k] = true;
					if(table[k] == 1){
						max_prime = max(max_prime,k);
					}
				}
			}
		}
	}

	if(max_prime == 0)printf("NA\n");
	else{
		printf("%d\n",max_prime);
	}

}

int main(){
	int limit;

	for(int i=0; i < NUM;i++)table[i] = 1;
	table[0] = 0;
	table[1] = 0;

	limit = sqrt(NUM);

	for(int i=2;i<=limit;i++){
		if(table[i] == 1){
			for(int k=2*i;k < NUM; k += i){
				table[k] = 0;
			}
		}
	}

	int n,budget;

	while(true){
		scanf("%d %d",&n,&budget);
		if(n == 0 && budget == 0)break;

		func(n,budget);
	}
	return 0;
}

Measured memory_bytes: 7880
#include <iostream>
#include <string>

using namespace std;

int main(void){
    string n;
    char a=0;
    char b=0;

    cin >> n;

    a=n[0];
    b=n[1];

    if(a=='9'||b=='9')cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = [int(t) - 1 for t in input().split()]

loc = 0
visited_bkt = [-1 for _ in range(2 * 10 ** 5 + 1)]
count = 0
loop_len = -1
while True:
    visited_bkt[loc + 1] = count
    loc = a[loc]
    count += 1
    if visited_bkt[loc + 1] >= 0:
        loop_len = count - visited_bkt[loc + 1]
        break
start_len = count - loop_len
print(visited_bkt.index(start_len + (k - start_len) % loop_len) if k >= count else visited_bkt.index(k))


Measured memory_bytes: 100688
#include <bits/stdc++.h>
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define vll vector< ll >
//#define M 100000
#define MD 1000000007
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= b; ++i)
#define fo(i,a,b) for(int i = a; i<= b; ++i)
#define pii pair<int,int>
#define vec(a) vector<a >
#define all(a) a.begin(),a.end()
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//#define int unsigned long long
//#define endl '\n'
#define IOS ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define ll long long  
#define int long long
using namespace std;
//using ll = unsigned long long;
ll md=MD;
//ll M=1073741824;
ll M=998244353;
//ll exp(ll a,ll b){ll r=1;while(b>0){if(b&1){r=r*(a%md);r=(r+md)%md;}b>>=1;a=(a%md)*(a%md);a=(a+md)%md;}return (r+md)%md;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll Min(int a,int b){if(a<b)return a; return b;}
ll Max(int a,int b){if(a>b)return a; return b;}
ll power(ll a,ll b){ll ans=1;while(b>0){if(b&1)ans=(ans*a)%M;a=(a*a)%M;b=b>>1;}return ans;}
const int INF=1000000000000000000;
//000111000111  1c7
//4x-2a=y 2i+4x-4i
int32_t main()
{
	IOS;
	int n;
	cin>>n;
	vector<int> a(n);
	set<int> st;
	for(int i=0;i<n;++i)
	{
		cin>>a[i];
		st.insert(a[i]);
	}
	sort(all(a));
	unordered_map<int,int> m1;
	for(int i=1;i<n;++i)
	{
		if(a[i-1]==a[i])
		{
			++m1[a[i]];
		}
	}
	int mx=a[n-1],cnt=0;
	while(!st.empty())
	{
		int x=*(st.begin());
		//st.erase(x);
		if(!m1[x])
		{
			++cnt;
		}
		int t1=x;
		while(t1<=mx)
		{
			st.erase(t1);
			t1+=x;
		}
	}
	cout<<cnt<<"\n";
	
	return 0;
}

Measured memory_bytes: 17388
a,b = list(map(int,input().split()))
s =input()
for i in range(a+b+1):
    if i == a:
        if s[i] !='-':
            print('No')
            break
    else:
        if s[i]=='-':
            print("No")
            break
            
        else:
            if int(s[i])<0 or 9<int(s[i]):
                print("No")
                break
else:
    print('Yes')

Measured memory_bytes: 9152
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;

using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vd = vector<double>;
using vvd = vector<vector<double>>;
using vvvd = vector<vector<vector<double>>>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vs = vector<string>;
using pint = pair<int, int>;
using Graph = vvi;

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

bool cmp(pint a, pint b) {return a.second < b.second;}
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}

int main() {
    int x, y, z;
    cin >> x >> y >> z;

    cout << (x - z) / (y + z) << endl;
}

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

#define rep(i, a, b) for (int i = (a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (a); i >= (int)(b); i--)
#define all(x) (x).begin(), (x).end()
using i32 = int32_t;
using i64 = int64_t;
using f32 = float;
using f64 = double;
using P   = pair<int, int>;

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

template <class T>
void dump_vec(const vector<T>& v) {
    auto len = v.size();
    rep(i, 0, len) {
        cout << v[i] << (i == (int)len - 1 ? "\n" : " ");
    }
}

struct FastIO {
    FastIO() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} FASTIO;

//---------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------

signed main() {
    priority_queue<int> q;
    while (true) {
        string s;
        cin >> s;
        if (s == "insert") {
            int a;
            cin >> a;
            q.push(a);
        } else if (s == "extract") {
            auto a = q.top();
            q.pop();
            cout << a << "\n";
        } else {
            break;
        }
    }
}



Measured memory_bytes: 7008
#include <bits/stdc++.h>
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>

//Some constants don't work
#ifndef INT_MAX
#define INT_MAX 2147483647
#endif
#ifndef INT_MIN
#define INT_MIN -2147483648
#endif
//short hand tricks
typedef long long ll;

using namespace std;

int main(int argc, char * argv[]) {
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    map<string, int> count;
    for(int i=0; i<n; i++) {
        string in;
        cin >> in;
        count[in]++;
    }
    cout << "AC x " << count["AC"] << "\n";
    cout << "WA x " << count["WA"] << "\n";
    cout << "TLE x " << count["TLE"] << "\n";
    cout << "RE x " << count["RE"] << "\n";
    return 0;
}


Measured memory_bytes: 3668
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;
use proconio::*;
use itertools::Itertools;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    input! {
        n:usize,
        t:usize,
        c:[(usize,usize);n],
    }
    
    let iter = c.iter().filter(|(cost,time)| *time <= t);
    
    if iter.clone().count()==0{
        println!("{}", "TLE");
        return;
    }
    
    let ans = iter.map(|(c, t)| c).min().unwrap();
    println!("{}", ans);
}

Measured memory_bytes: 2188
package main

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

var (
	inn = bufio.NewScanner(os.Stdin)
	out = bufio.NewWriter(os.Stdout)
)

func main() {
	defer out.Flush()
	inn.Buffer([]byte{}, 1000000)
	inn.Split(bufio.ScanWords)
	//prep
	a := rdll()
	b := rdd()
	bb := int64(math.Round(b * 100))
	Fprint(out, a*bb/100)
}

//-------------------template------------------
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}
func maxll(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}
func rd() (x int) {
	inn.Scan()
	x, _ = strconv.Atoi(string(inn.Bytes()))
	return x
}
func rdll() (x int64) {
	inn.Scan()
	x, _ = strconv.ParseInt(string(inn.Bytes()), 10, 64)
	return x
}
func rdd() (x float64) {
	inn.Scan()
	x, _ = strconv.ParseFloat(string(inn.Bytes()), 64)
	return x
}
func rds() string {
	inn.Scan()
	return string(inn.Bytes())
}


Measured memory_bytes: 1732
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <math.h>
#include<iomanip>
using namespace std;

int gcd(int a,int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

int main() {
    int A, B;
    cin >> A >> B;
    cout << 1LL * A * B / gcd(A, B) << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
const int N=10e5+3;
vector<pair<int,string>>vc;
bool AC[N];
int WA[N];
int main()

{

/*

int n;
cin>>n;
string s;
cin>>s;
int maxi=0;
int counter=0;
int GS=0;
for(int i=0;i<s.size();i++){

    if(s[i]=='G')GS++;

}

bool reham=true;

for(int i=0;i<s.size();i++){
    if(s[i]=='G') counter++;
    else if(s[i]=='S' && reham==true && counter>0) {counter++;  reham=false;}
    else {


        counter=0;
        reham=true;
    }
maxi=max(counter,maxi);
//cout<<counter;

}

//cout<<counter<<endl;


if(maxi>GS)cout<<GS;
else cout<<maxi;*/



    /*
   int test;
cin>>test;
for(int i=0;i<test;i++){
    int pages,t,d;
    cin>>pages>>t>>d;

if(d+t == pages )





}

    */
/*

   long long int n,x;
    cin>>n>>x;
    if(n<x){cout<<"NO"; return 0;}
   int k=0;
long long int w=n;
   while(n>0){

    arr[k]=n%2;
    n=n/2;
    k++;

}


   int counter=0;

   for(int i=0;i<k;i++){
    if(arr[i]==1) counter++;}

   if(counter>x){cout<<"NO"; return 0;}

cout<<"YES"<<endl;

if(counter==x){

    long long raqam;

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

    if(arr[i]==1){raqam=pow(2,i);  cout<<raqam<<endl;}

}


}


int cnt=0;
else{


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

    if(arr[i]==1)cnt++;
    if(arr[i]==1&& cnt>0) {
            for(int j=i;j<k;j++){
        string reham+=to_string(arr[i]);

    }

    for()


    counter++
}
if(counter==k)break;








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






for(auto x: res)cout<<x<<" ";


}


/*




*/

/*
vector<int>vc;


int tests;
cin>>tests;
for(int i=0;i<tests;i++{

int sum=0;
long long m;
cin>>m;
for(int i=0;i<m;i++){

    int x;
    cin>>x;
    sum+=x;

}

vc.push_back(sum);



}


*/

for(int i=0;i<N;i++){AC[i]=false;
WA[i]=0;}
int accepted=0,wrong=0;
int prob,n;
cin>>prob>>n;
for(int i=0;i<n;i++){

    string str;
    int num;
    cin>>num>>str;
    if(AC[num]==true)continue;
    if(str=="AC"){

        AC[num]=true;
        accepted++;
        wrong+=WA[num];
    }


    else if(str=="WA") WA[num]++;

}



cout<<accepted<<" "<<wrong;











    return 0;
}


Measured memory_bytes: 5120
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int N;
int A, B;

int main()
{
    cin >> N;
    if (N == 1)
    {
        cout << "Hello World" << endl;
        return 0;
    }

    cin >> A >> B;
    cout << A + B << endl;
}


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

int main() {
  int n; cin >> n;
  int sum=0;
  for (int i=0;i<n;i++) {
    int num;
    cin >> num;
    sum+= num%2;
  }
  if(sum%2) {
    cout << "NO" << endl;
  }
  else {
    cout << "YES" << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(void) {
	int A, B, C;
	cin >> A >> B >> C;
	if (A == B && B == C && C == A) {
		cout << "No" << endl;
	}
	else{
		if (A == B || B == C || C == A) cout << "Yes" << endl;
		else cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
using namespace std;
typedef long long ll;
const int maxn=5000+10,maxm=200+10;
ll v[maxn][maxn],d[maxn];
int b[maxm][maxn],a[maxn];
int sta[maxn],fa[maxn],lc[maxn],rc[maxn],L[maxn],R[maxn];
int i,j,k,l,t,n,m,top,root;
ll ans;
void ins(int mid,int l,int r,int x){
	v[l][r]+=(ll)x;
	v[l][mid-1]-=(ll)x;
	v[mid+1][r]-=(ll)x;
}
void dfs(int x){
	L[x]=R[x]=x;
	if (lc[x]){
		dfs(lc[x]);
		L[x]=L[lc[x]];
	}
	if (rc[x]){
		dfs(rc[x]);
		R[x]=R[rc[x]];
	}
	ins(x,L[x],R[x],a[x]);
}
void work(int id){
	int i,j;
	fo(i,1,n) a[i]=b[id][i];
	fo(i,1,n) fa[i]=lc[i]=rc[i]=0;
	top=0;
	fo(i,1,n){
		while (top&&a[i]>a[sta[top]]){
			if (fa[sta[top]]) rc[sta[top]]=i;
			rc[sta[top]]=lc[i];
			lc[i]=sta[top];
			top--;
		}
		fa[i]=sta[top];
		rc[sta[top]]=i;
		sta[++top]=i;
	}
	root=sta[1];
	dfs(root);
}
int main(){
	scanf("%d%d",&n,&m);
	fo(i,2,n){
		scanf("%d",&d[i]);
		d[i]+=d[i-1];
	}
	fo(i,1,n)
		fo(j,1,m) scanf("%d",&b[j][i]);
	fo(i,1,m) work(i);
	fo(i,1,n)
		fd(j,n,i)
			v[i][j]=v[i][j]+v[i-1][j]+v[i][j+1]-v[i-1][j+1];
	fo(i,1,n)
		fo(j,i,n)
			ans=max(ans,v[i][j]-(d[j]-d[i]));
	printf("%lld\n",ans);
}

Measured memory_bytes: 172544
#include <bits/stdc++.h>
#include <iostream> 
#include <stdio.h>
#define MAX 20000005
typedef long long ll; 
using namespace std; 
int main () 
{

    int a , b, c; 
    int k; 
    cin >> a >> b >> c; 
    cin >> k ;
    int total = 0;  

    while (b<=a) 
    {
        b = b*2; 
        total ++; 
    }
    while (c<=b) 
    {
        c = c*2; 
        total++; 
    }
    if (total <= k) {
        cout << "Yes" << endl; 
        
    }else 
        {
            cout << "No" << endl; 
        }

    return 0; 
}


Measured memory_bytes: 3616
#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 n,k;
    string s;
    cin >> n >> k;
    if(n%k == 0)cout << 0 << endl;
    else cout << 1 << endl;
}


Measured memory_bytes: 256
using System;
using System.Linq;

namespace ALDS1_12_A_MinimumSpanningTree
{
	class Program
	{
		static void Main ( string[] args )
		{
			int arraySize = int.Parse (Console.ReadLine ());

			int[][] inputArray = new int[arraySize][];

			char[] splits = { ' ' };
			for (int lp = 0; lp < arraySize; lp++)
			{
				inputArray[lp] = Array.ConvertAll (Console.ReadLine ().Split (splits, StringSplitOptions.RemoveEmptyEntries), int.Parse);
			}

			MinimunSpanningTree m = new MinimunSpanningTree (inputArray);
			int result = m.Prim ();

			Console.WriteLine (result);
		}
	}

	class MinimunSpanningTree
	{
		public MinimunSpanningTree ( int[][] adjacencyArray )
		{
			this.Size = adjacencyArray.Length;

			this.AdjacencyArray = new int[Size][];

			for (int lp = 0; lp < Size; lp++)
			{
				this.AdjacencyArray[lp] = new int[Size];

				for (int lp2 = 0; lp2 < Size; lp2++)
				{
					this.AdjacencyArray[lp][lp2] =
						adjacencyArray[lp][lp2] != NotExist ? adjacencyArray[lp][lp2] : Infinity;
				}
			}
		}

		private int[][] AdjacencyArray { set; get; }
		private const int NotExist = -1;
		private const int Infinity = int.MaxValue;

		private int Size { set; get; }

		public int Prim ()
		{
			//initilize
			int[] visitState = new int[Size];
			const int Stay = 1;
			const int Visited = 2;

			int[] weight = Enumerable.Repeat (Infinity, Size).ToArray ();

			int[] parent = Enumerable.Repeat (NotExist, Size).ToArray ();

			//process
			weight[0] = 0;

			while (true)
			{
				int minCost = Infinity;
				int index = 0;

				for (int lp = 0; lp < Size; lp++)
				{
					if (visitState[lp] != Visited && weight[lp] < minCost)
					{
						minCost = weight[lp];
						index = lp;
					}
				}

				if (minCost == Infinity)
				{
					break;
				}

				visitState[index] = Visited;

				for (int lp = 0; lp < Size; lp++)
				{
					if (visitState[lp] != Visited && AdjacencyArray[index][lp] != Infinity)
					{
						if (AdjacencyArray[index][lp] < weight[lp])
						{
							weight[lp] = AdjacencyArray[index][lp];
							parent[lp] = index;
							visitState[lp] = Stay;
						}
					}
				}
			}

			int sum = 0;

			for (int lp = 0; lp < Size; lp++)
			{
				if (parent[lp] != NotExist)
				{
					sum += AdjacencyArray[lp][parent[lp]];
				}
			}

			return sum;
		}
	}
}

Measured memory_bytes: 9776
#!/usr/bin/env python3
import sys


def solve(N: int, K: int, S: str):
    ranlength = []
    lastBit = ""
    lastLength = 0
    for c in S:
        if lastBit == "":
            lastBit = c
            lastLength += 1
            continue
        if lastBit == c:
            lastLength += 1
            continue
        else:
            ranlength.append((lastLength, int(lastBit)))
            lastLength = 1
            lastBit = c
            continue
    ranlength.append((lastLength, int(lastBit)))
    count0 = 0
    length0 = 0
    end = 0
    for i in range(len(ranlength)):
        if count0 == K and ranlength[i][1] == 0:
            break
        if ranlength[i][1] == 0:
            count0 += 1
        length0 += ranlength[i][0]
        end = i
    # これで最初のKこの入れ替えでの長さが求まる
    nextLength = length0
    lastMax = length0
    begin = 0
    #print(begin, end, nextLength)
    while end + 1 < len(ranlength):
        nextLength += ranlength[end + 1][0]
        end += 1
        for i in range(end + 1, len(ranlength)):
            if ranlength[i][1] == 0:
                break
            else:
                nextLength += ranlength[i][0]
            end = i
        for i in range(begin, len(ranlength)):
            begin = i + 1
            nextLength -= ranlength[i][0]
            if ranlength[i][1] == 0:
                break
        lastMax = max(lastMax, nextLength)
        #print(begin, end, nextLength)
    #print(lastMax, begin, end)
    print(lastMax)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    S = next(tokens)  # type: int
    # print(S)
    solve(N, K, S)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10484
import java.util.Scanner;

public class Main {
    public static void main(String args[]) {
        try (Scanner in = new Scanner(System.in)) {
            String S = in.next();
            int min = (int) 1e9;
            for (int i = 3; i <= S.length(); i++) {
                String sub = S.substring(i - 3, i);
                min = Math.min(min, Math.abs(753 - Integer.parseInt(sub)));
            }
            System.out.println(min);
        }
    }
}


Measured memory_bytes: 21588
#include<stdio.h>
int main(void){
    int n, i, s=0;
    scanf("%d",&n);
    for(i=1;i<=n;i++){
        if((i>0)&&(i<10)) s+=1;
        else if((i>=100)&&(i<1000)) s+=1;
        else if((i>=10000)&&(i<100000)) s+=1;
    }
    printf("%d\n",s);
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
	 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
#define clr(a) memset(a,0,sizeof(a))
#define umap unordered_map
#define uset unordered_set
#define fr first
#define sc second
#define pb push_back
#define M int(1e9+7)
#define endl '\n'
	
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
	
	
int main(){
	fast_io; cout_precision;
	int n;	cin >> n ;
	int arr[n];
	for(int i=0; i<n; i++)	cin >> arr[i];
	sort(arr,arr+n);
	int ans = INT_MAX;
	for(int pos = arr[0]; pos <=arr[n-1]; pos++){
		int a =0;
		for(int i=0; i<n; i++)	a+=pow(arr[i]-pos , 2);	
		ans = min(ans , a);
	}	
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int n;
    scanf("%d",&n);
    //1桁目だけが欲しいので
    n = n % 10;
    switch(n){
        //3だったらbon
        case 3:
            printf("bon");
            break;
        //0,1,6,8だったらpon
        case 0:
        case 1:
        case 6:
        case 8:
            printf("pon");
            break;
        //2,4,5,7,9はhon
        default:
            printf("hon");
            break;
    }
    //改行
    printf("\n");
    return 0;
}

Measured memory_bytes: 1696
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int main(){
    string s;
    cin >> s;
    char unit[]={'a','e','i','o','u'};
    bool flag = false;
    rep(i,5){
        if(s.find(unit[i]) != -1){
            flag = true;
        }
    }
    if(flag){
        cout << "vowel" << endl;
    }else{
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n;
  scanf("%d",&n);
  int ball[10];
  int i,j;
  for(j=0;j<n;j++){
    for(i=0;i<10;i++) scanf("%d",&ball[i]);
    int a=0,b=0;
    for(i=0;i<10;i++){
      if(a<ball[i]) a = ball[i];
      else if(b<ball[i]) b = ball[i];
      else{
	printf("NO\n");
	break;
      }
      if(i==9) printf("YES\n");
    }
  }
  return 0;
}

Measured memory_bytes: 1008