akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<set>
using namespace std;

int main(){
    int N,K;
    cin>>N>>K;
    int64_t a[100010]={};
    for(int i=1;i<=N;i++){
        cin>>a[i];
    }
    int64_t sum[100010]={};
    for(int i=1;i<=N;i++){
        sum[i]=sum[i-1]+a[i];
    }
    int64_t lef[100010]={};
    int64_t rig[100010]={};
    int64_t zero=0;
    for(int i=1;i<=N+1;i++){
        lef[i]=lef[i-1]+max(a[i],zero);
    }
    for(int i=N;i>=0;i--){
        rig[i]=rig[i+1]+max(a[i],zero);
    }
    int64_t res=0;
    for(int i=1;i<=N+1-K;i++){
        int64_t tmp=sum[i+K-1]-sum[i-1];
        if(tmp>0){
            res = max(res,tmp+lef[i-1]+rig[i+K]);
        }else{
            res = max(res,lef[i-1]+rig[i+K]);
        }
    }
    cout<<res<<endl;
    
    return 0;
}


Measured memory_bytes: 3456
#include<stdio.h>
#include<algorithm>
using namespace std;
int K,N,Max,GCD;

int gcd(int a,int b)
{
	if(!b)return a;
	return gcd(b,a%b);
}

int main()
{
	int i,x;
	
	scanf("%d%d%d",&N,&K,&x);
	Max=GCD=x;
	for(i=2;i<=N;i++)
	{
		scanf("%d",&x);
		Max=max(Max,x);
		GCD=gcd(GCD,x);
	}
	
	if(K%GCD==0&&K<=Max)puts("POSSIBLE");
	else puts("IMPOSSIBLE");
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();
		for(int i = 0; i < s.length; i++) {
			if(s[i] == '7') {
				System.out.println("Yes");
				return;
			}
		}
		System.out.println("No");
	}
}


Measured memory_bytes: 26948
N=int(input())

p=[0,0]
time=0
for i in range(N):
    t,x,y=map(int,input().split())
    cost=abs(x-p[0])+abs(y-p[1])
    if t<time+cost:
        print("No")
        exit()
    else:
        if (t-time-cost)%2!=0:
            print("No")
            exit()
        else:
            p=[x,y]
            time=t
print("Yes")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }

void dfs(vector<int> &ans, const vector<vector<int>> &G, int v, int p) {
    for(auto u : G[v]) {
        if (u == p) continue;
        ans[u] += ans[v];
        dfs(ans, G, u, v);
    }
}

int main()
{
    int N, Q;
    cin >> N >> Q;
    vector<vector<int>> to(N);
    vector<int> ans(N);
    rep(i,N-1) {
        int a, b;
        cin >> a >> b;
        a--; b --;
        to[a].push_back(b);
        to[b].push_back(a);
    }
    rep(i,Q) {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }
    dfs(ans, to, 0, -1);
    rep(i, N)
        printf("%d%c", ans[i], i==(N-1)?'\n':' ');
    return 0;
}


Measured memory_bytes: 29696
#include <bits/stdc++.h>
using namespace std;
int main(){
	int w,h,n;
	cin>>w>>h>>n;
	int x1=0,y1=0,x2=w,y2=h;
	for(int i=0;i<n;i++){
		int p,q,r;
		cin>>p>>q>>r;
		if(r==1&&x1<p) x1=p;
		else if(r==2&&x2>p) x2=p;
		else if(r==3&&y1<q) y1=q;
		else if(r==4&&y2>q) y2=q;
	}
	w=x2-x1;
	h=y2-y1;
	if(w<=0||h<=0)cout<<0<<endl;
	else cout<<w*h<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[200000];

int main(){
	int n;cin>>n;
	set<int>se;
	bool ok=true;
	rep(i,n){
		scanf("%d",&a[i]);
		se.insert(a[i]);
		if(a[i])ok=false;
	}
	if(ok){
		puts("Yes");return 0;
	}
	vector<int>v;
	for(int i:se)v.push_back(i);
	if(v.size()!=2&&v.size()!=3){
		puts("No");return 0;
	}
	if(v.size()==2){
		if(v[0]!=0){
			puts("No");return 0;
		}
		int c1=0,c2=0;
		rep(i,n){
			if(a[i]==v[1])c1++;
			else c2++;
		}
		if(c1==c2*2){
			puts("Yes");return 0;
		}
		else{
			puts("No");return 0;
		}
	}
	else{
		if((v[0]^v[1])!=v[2]){
			puts("No");return 0;
		}
		int c1=0,c2=0,c3=0;
		rep(i,n){
			if(a[i]==v[0])c1++;
			if(a[i]==v[1])c2++;
			if(a[i]==v[2])c3++;
		}
		if(c1==c2&&c2==c3){
			puts("Yes");return 0;
		}
		else{
			puts("No");return 0;
		}
	}
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define rep(i, n) REP(i, 0, n)
const int INF=1e9;
const int MAX=100005;
const int MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,n){cout<<arr[i][j]<<" ";}cout<<endl;}
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

bool ismm(ll x){
    return x>=1&&x<=12;
}
// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    ll hajime = (s[0]-'0')*10+(s[1]-'0');
    ll tugi = (s[2]-'0')*10+(s[3]-'0');
    if(ismm(hajime)&&ismm(tugi)){
        cout << "AMBIGUOUS" << endl;
        return 0;
    }
    if(!ismm(hajime)&&!ismm(tugi)){
        cout << "NA" << endl;
        return 0;
    }
    if(ismm(hajime)&&!ismm(tugi)){
        cout << "MMYY" << endl;
        return 0;
    }
    if(!ismm(hajime)&&ismm(tugi)){
        cout << "YYMM" << endl;
        return 0;
    }
    return  0;
}


Measured memory_bytes: 256
def MI():return map(int,input().split())
def LI():return list(MI())

from collections import deque
INF=float("inf")
n,x,y=MI()
x-=1
y-=1
ans=[0]*n

for sv in range(n):
  dist=[INF]*n
  q=deque()
  def push(v,d):
    if dist[v]!=INF:
      return
    dist[v]=d
    q.append(v)
  push(sv,0)
  while q:
    v=q.popleft()
    d=dist[v]
    if v-1>=0:push(v-1,d+1)
    if v+1<n:push(v+1,d+1)  
    if v==x:push(y,d+1)
    if v==y:push(x,d+1)
        
  for i in range(n):ans[dist[i]]+=1
for i in range(1,n):print(ans[i]//2)



Measured memory_bytes: 55260
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

n = inp[0]
min = 1e20
(1..((n**0.5).ceil)).each do |i|
  if n % i == 0
    min = [min, (n/i-1)+(i-1)].min
  end
end
puts min

#!?

Measured memory_bytes: 1916
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

char str[1010];
int m;

int main() {
	int n;
	scanf("%s%d",str,&m);
	n=strlen(str);

	int c=0;
	for(int i=0;i<n;i+=m) printf("%c",str[i]);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using ll=long long;
using namespace std;
#define rep_i(i, n) for (int i = 0; i < (n); ++i)
#define rep_ll(i, n) for (long long i = 0; i < (n); ++i)
#define r_rep_i(i, start, end) for (int i = (start); i < (end); ++i)
#define r_rep_ll(i, start, end) for (long long i = (start); i < (end); ++i)
#define debug_vi(v) copy((v).begin(), (v).end(), ostream_iterator<int>(cout, " "));
#define debug_vll(v) copy((v).begin(), (v).end(), ostream_iterator<long long>(cout, " "));
#define debug_vd(v) copy((v).begin(), (v).end(), ostream_iterator<double>(cout, " "));
#define sort_v(v) sort((v).begin(), (v).end()); //昇順
#define d_sort_vi(v) sort((v).begin(), (v).end(), greater<int>()); //降
#define d_sort_vll(v) sort((v).begin(), (v).end(), greater<long long>()); //降
#define d_sort_vd(v) sort((v).begin(), (v).end(), greater<double>()); //昇順
#define say(t) cout << (t) << endl;
#define sum_vi(v) accumulate((v).begin(), (v).end(), 0);
#define sum_vll(v)accumulate((v).begin(), (v).end(), 0LL);

ll gcd(ll a, ll b) { return b?gcd(b, a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a, b)*b;}
const int IINF=(1<<30);
const ll LLINF = 1LL<<60;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  ll x, y, a, b, c;
  cin >> x >> y >> a >> b >> c;
  vector<ll> A(a);
  vector<ll> B(b);
  vector<ll> C(c);
  rep_i(i, a){
    cin >> A[i];
  }
  rep_i(i, b){
    cin >> B[i];
  }
  rep_i(i, c){
    cin >> C[i];
  }
  d_sort_vll(A);
  d_sort_vll(B);
  d_sort_vll(C);
  
  ll ans = 0;
  rep_i(i, x){
    ans += A[i];
  }
  rep_i(i, y){
    ans += B[i];
  }

  int ic = 0;
  int ia = x - 1;
  int ib = y - 1;
  while(ic < c){
    if(ia < 0 && ib <0){
      break;
    }
    if(ia >= 0 && ib >= 0){
      if(C[ic] <= A[ia] && C[ic] <= B[ib]){
        break;
      }else{
        if(A[ia] < B[ib]){
          ans -= A[ia];
          ans += C[ic];
          ia -= 1;
        }else{
          ans -= B[ib];
          ans += C[ic];
          ib -= 1;
        }
      }
    }else if(ib < 0){
      if(C[ic] <= A[ia]){
        break;
      }else{
        ans -= A[ia];
        ans += C[ic];
        ia -= 1;
      }
    }else{
      if(C[ic] <= B[ib]){
        break;
      }else{
        ans -= B[ib];
        ans += C[ic];
        ib -= 1;
      }
    }
    ic += 1;
  }
  cout << ans << endl;
}

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

int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    double l;
    cin >> l;
    
    cout << fixed << setprecision(7) <<(l/3)*(l/3)*(l/3) << "\n";
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
	int nomor1, nomor2;
	int hasil;
	scanf("%d %d", &nomor1, &nomor2);
	
	if(nomor2 % nomor1 == 0){
		hasil = nomor1 + nomor2;
		printf("%d", hasil);
	}else if(nomor2 % nomor1 != 0){
		hasil = nomor2 - nomor1;
		printf("%d", hasil);
	}
	return 0;
}

Measured memory_bytes: 3196
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO.Pipes;

namespace cswork
{
    class Program
    {
        public Program() { }

        Scanner cin;
        const int MAXIN = 1024;
        bool[] used = new bool[MAXIN];
        int[] perm = new int[MAXIN];

        List<int[]> permList = new List<int[]>();

        void Omame()
        {
            cin = new Scanner();
            int n = cin.nextInt();
            int m = cin.nextInt();
            HashSet<int> a = new HashSet<int>();
            for (int i = 0; i < m; i++)
            {
                a.Add(cin.nextInt() - 1);
            }

            long[] count = new long[n];
            if (a.Contains(0))
            {
                count[0] = 0;
            }
            else
            {
                count[0] = 1;
            }

            if (n > 1)
            {
                if (a.Contains(1))
                {
                    count[1] = 0;
                }
                else
                {
                    count[1] = count[0] + 1;
                }
            }

            for (int i = 2; i < n; i++)
            {
                if (a.Contains(i))
                {
                    count[i] = 0;
                }
                else
                {
                    count[i] = count[i - 1] + count[i - 2];
                    count[i] %= 1000000007;
                }
            }

            Console.WriteLine(count[n - 1] );
        }

        static void Main(string[] args)
        {
            new Program().Omame();
        }

        public void Permutation(int pos, int n, int length)
        {
            if (pos == n)
            {
                permList.Add((int[])perm.Clone());
            }

            for (int i = 0; i < n; i++)
            {
                if (!used[i])
                {
                    perm[pos] = i;
                    used[i] = true;
                    Permutation(pos + 1, n, length);
                    used[i] = false;
                }
            }
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();

            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next();
        }

        public int nextInt()
        {
            return int.Parse(next());
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }
    }
}

Measured memory_bytes: 21848
#include <string.h>
#include <stdio.h>
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <algorithm>
#include <unordered_set>
#include <set>
#include <queue> 

using namespace std;

typedef long long LL;
const LL inf = (1L << 40);
#define MOD (1e9+7)


int main() {
	
	ios_base::sync_with_stdio(false);
	
	int n;
	cin >> n;
	if (n <= 999) {
		cout << "ABC" << endl;
	}
	else {
		cout << "ABD" << endl;
	}

	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int A[15], B[15];
	scanf("%d %d", A,B);
	int sum = *A + *B;
	if (10 <= sum)
	{
		printf("error\n");
	}
	else {
		printf("%d\n", sum);
	}

	return 0;
}

Measured memory_bytes: 128
#include <cstdio>

int main()
{
    int a, b;
    int ans[21][21] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,0,0,0,7,8,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,0,0,0,9,9,10,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,0,0,0,11,11,11,12,13,15,17,19,21,23,25,27,29,31,33,35,37,39,0,0,0,13,13,13,13,14,15,17,19,21,23,25,27,29,31,33,35,37,39,0,0,0,15,15,15,15,15,16,17,19,21,23,25,27,29,31,33,35,37,39,0,0,0,17,17,17,17,17,17,18,19,21,23,25,27,29,31,33,35,37,39,0,0,0,19,19,19,19,19,19,19,20,21,23,25,27,29,31,33,35,37,39,0,0,0,21,21,21,21,21,21,21,21,22,23,25,27,29,31,33,35,37,39,0,0,0,23,23,23,23,23,23,23,23,23,24,25,27,29,31,33,35,37,39,0,0,0,25,25,25,25,25,25,25,25,25,25,26,27,29,31,33,35,37,39,0,0,0,27,27,27,27,27,27,27,27,27,27,27,28,29,31,33,35,37,39,0,0,0,29,29,29,29,29,29,29,29,29,29,29,29,30,31,33,35,37,39,0,0,0,31,31,31,31,31,31,31,31,31,31,31,31,31,32,33,35,37,39,0,0,0,33,33,33,33,33,33,33,33,33,33,33,33,33,33,34,35,37,39,0,0,0,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,36,37,39,0,0,0,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,38,39,0,0,0,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,40};
    /*int aa, ab, bb;
    for (int i = 3; i < 21; ++i)
    {
        for (int j = 3; j < 21; ++j)
        {
            res = 0;
            aa = i + i - 1;
            ab = i + j;
            bb = j + j - 1;
            res = max(res, aa);
            res = max(res, ab);
            res = max(res, bb);
            ans[i][j] = res;
        }
    }
    for (int i = 0; i < 21; ++i)
    {
        for (int j = 0; j < 21; ++j)
        {
            cout << ans[i][j] << ",";
        }
    }*/
    while (scanf("%d%d", &a, &b)!= EOF)
    {
        printf("%d\n", ans[a][b]);
    }
    return 0;
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	string s; cin>>s;
	int n = s.size();
	int mod = 2019;
	vector<int> pw(n);
	pw[0] = 1;
	for(int i = 1; i < n; i++){
		pw[i] = (pw[i - 1]*10) % mod;
	}
	map<int, int> mp;
	int cur = 0, ans = 0;
	mp[0] = 1;
	for(int i = 0; i < n; i++){
		cur = (cur*10 + s[i] - '0') % mod;
		int tmp = cur*pw[n - 1 - i]%mod;
		ans += mp[tmp];
		mp[tmp]++;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define lli long long int
#define timesave ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;


void solve()
{
    int x, n;
    cin >> x >> n;

    int arr[n+5];
    map<int,int> mp;

    for(int i = 1; i <= n; i++) {cin >> arr[i]; mp[arr[i]] = 1;}
    
    int ans, d = 1e9;

    for(int i = -100; i <= 200; i++){
        if(mp[i]) continue;
        int dd = abs(x-i);
        if(dd < d){
            ans = i;
            d = dd;
        }
    }
    if(n == 0) ans = x;

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


int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //timesave; 
    
    int tc = 1;
    //cin >> tc;
    while(tc--) solve();

    return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <iostream>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
vector<vector<ll>> DP;

int main(void) {
  ios::sync_with_stdio(false);
  int H, W, K;
  cin >> H >> W >> K;
  vector<vector<char>> S(H, vector<char>(W));
  vector<int> Empty(H, 0);
  rep(i, H) {
    rep(j, W) {
      cin >> S[i][j];
      if (S[i][j] == '#') Empty[i]++;
    }
  }

  vector<vector<int>> A(H, vector<int>(W));
  int tmpA = 1;
  int firstRow = -1;
  rep(i, H) {
    int rowK = 0;
    if (firstRow == -1) {
      if (Empty[i] > 0)
        firstRow = i;
      else
        continue;
    }

    rep(j, W) {
      if (Empty[i] != 0) {
        A[i][j] = tmpA;
        if (S[i][j] == '#') {
          rowK++;
          if (rowK < Empty[i] || j == (W - 1)) {
            tmpA++;
          }
        } else {
          if (j == (W - 1)) tmpA++;
        }
      } else {
        // consider 1st row.
        if (i != 0) {
          A[i][j] = A[i - 1][j];
        }
      }
    }
  }
  rep(i, firstRow) { rep(j, W) A[i][j] = A[firstRow][j]; }

  rep(i, H) {
    rep(j, W) { cout << A[i][j] << " "; }
    cout << endl;
  }
  return 0;
}


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

char s[105];

int main() {
    scanf("%s", s);
    
    int n = strlen(s);
    int res = 0;
    
    for (int i = 0; i < n / 2; i++) {
        res += (s[i] != s[n - i - 1]);
    }
    
    printf("%d\n", res);
}

Measured memory_bytes: 256
def main():
    from sys import stdin
    a,b,c,x,y = map(int,stdin.readline().rstrip().split())

    p1 = a*x+b*y
    p2 = max(x,y)*c*2
    p3 = min(x,y)*c*2+max(x-y,0)*a+max(y-x,0)*b
    print(min(p1,p2,p3))
main()

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdint>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
// constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

namespace detail {
template <typename Tp, size_t N>
std::vector<Tp> make_vector(
    std::vector<size_t>& sizes,
    typename std::enable_if<(N == 1), Tp const&>::type x
) {
  return std::vector<Tp>(sizes[0], x);
}
template <typename Tp, size_t N>
auto make_vector(
    std::vector<size_t>& sizes,
    typename std::enable_if<(N > 1), Tp const&>::type x
) {
  size_t size = sizes[N-1];
  sizes.pop_back();
  return std::vector<decltype(make_vector<Tp, N-1>(sizes, x))>(
      size, make_vector<Tp, N-1>(sizes, x)
  );
}
}  // detail::

template <typename Tp, size_t N>
auto make_vector(size_t const(&sizes)[N], Tp const& x = Tp()) {
  std::vector<size_t> s(N);
  for (size_t i = 0; i < N; ++i) s[i] = sizes[N-i-1];
  return detail::make_vector<Tp, N>(s, x);
}

int main() {
  size_t n;
  scanf("%zu", &n);

  std::vector<intmax_t> a(n);
  for (auto& ai: a) scanf("%jd", &ai);

  intmax_t inf = 1e18;
  auto dp = make_vector<intmax_t>({n+1, 2_zu}, -inf);
  dp[0][0] = 0_jd;

  for (size_t i = 0; i < n; ++i) {
    dp[i+1][0] = std::max({dp[i+1][0], dp[i][0]+a[i], dp[i][1]-a[i]});
    dp[i+1][1] = std::max({dp[i+1][1], dp[i][0]-a[i], dp[i][1]+a[i]});
  }

  printf("%jd\n", dp[n][0]);
}


Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	long long sum = 0;
	for (int i = 0; i < k; i++) {
		sum += a[i];
	}
	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
using namespace std;
bool primeNumber(int n){
    if(n < 2) return false;
    else{
        for(int i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}

int main(){
    int x;
    cin>>x;
    while(primeNumber(x)==false){
        x=x+1;
    }
    cout<<x;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void)
{
    int N;
    while (1)
    {
        cin >> N;
        if (!N) break;
        vector<int> a(N);
        int d;
        int res = 1000000;
        for (int i = 0; i < N; i++) cin >> a[i];
        sort(a.begin(), a.end());
        for (int i = 1; i < N; i++) { d = a[i] - a[i - 1]; if (res > d) res = d; }
        cout << res << endl;
    }
    return 0;
}


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


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int a, b, k;
	cin >> a >> b >> k;
	vector<int> div;
	for (int i = 1; i <= max(a, b); ++i) {
		if (a % i == 0 && b % i == 0) {
			div.push_back(i);
		}
	}
	sort(div.begin(), div.end());
	reverse(div.begin(), div.end());
	cout << div[k - 1] << endl;
	return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

const ll mod = 1000000007;

static const ll INF = 1e15;

int main(void)	
{
	ll n = 0;
	cin >> n;
	cout << (n + 1) / 2 << endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.1415926535897
using namespace std;
typedef long long ll;
const int INF = 1000000000;
const ll LINF = 1000000000000000000; //1e18
const double EPS = 1e-10;

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

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

    vector<int> x(N);
    int mx = -1;
    deque<int> diff;
    int temp;
    for (int i = 0; i < N; i++)
    {
        cin >> x[i];
        temp = abs(X - x[i]);
        mx = max(mx, temp);
        diff.push_back(temp);
    }

    //debug
    // for (int i = 0; i < N; i++)
    // {
    //     cout << diff[i] << " ";
    // }
    // printf("\n");

    // 一番最大の公約数を見つける。
    int ans = diff[0];
    for (int i = 0; i < N; i++)
    {
        ans = gcd(ans, diff[i]);
    }

    printf("%d\n", ans);
    return (0);
}

Measured memory_bytes: 1024
#include <cstdio>
int main(){
	int H,W,h,w;
	scanf("%d%d%d%d",&H,&W,&h,&w);
	if (H%h==0 && W%w==0){
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
	if (H%h){
		for (int i=0;i<H;i++,printf("\n"))
			for (int j=0;j<W;j++)
			if (i%h==0) printf("%d ",(h-1)*1000-1);
				else printf("-1000 ");
	}
	else
		for (int i=0;i<H;i++,printf("\n"))
			for (int j=0;j<W;j++)
			if (j%w==0) printf("%d ",(w-1)*1000-1);
				else printf("-1000 ");
}

Measured memory_bytes: 1664
import java.util.*;
    public class Main {
     
    	public static void main(String[] args) {
    			
    		Scanner scan =new Scanner(System.in);
    		
    		int a=Integer.parseInt(scan.next());
    		int b=Integer.parseInt(scan.next());
    		System.out.print(--a*--b);
   
     
    }
    }
// end 

Measured memory_bytes: 21716
#include "bits/stdc++.h"
#define fi first
#define se second
#define all(x) x.begin(), x.end()
using namespace std;
using ull = unsigned long long;
using ll = long long;

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    cout << min(B / A, C) << endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second
#define mp make_pair
 
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N, M, P[int(1e5 + 5)];
int X, Y, UF[int(1e5 + 5)];

int Unite(){
  int UX = UF[X], UY = UF[Y];
  while (UX != UF[UX]) UX = UF[UX];
  while (UY != UF[UY]) UY = UF[UY];

  UF[max(UX, UY)] = min(UX, UY);
  UF[X] = min(UX, UY);
  UF[Y] = min(UX, UY);
  return 0;
}

int main(){
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= N; i++) UF[i] = i, scanf("%d", P + i);

  for (int i = 0; i < M; i++){
    scanf("%d%d", &X, &Y); Unite();
  }

  int ans = 0;
  for (int i = 1; i <= N; i++){
    int G = UF[i];
    while (G != UF[G]) G = UF[G];
    UF[i] = G;
  }

  for (int i = 1; i <= N; i++){
    if (UF[i] == UF[P[i]]) ans++;
  }

  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-8;


int ccw(LP v1, LP v2) {
	ll z = v1.first*v2.second - v2.first*v1.second;
	if (z < 0)return -1;
	if (z > 0)return 1;
	return 0;
}

int n, m;
void solve() {
	if (n == 0 || m == 0 || n + m == 1) {
		cout << "YES" << endl; return;
	}
	vector<LP> w(n), b(m);
	vector<LP> v;
	rep(i, n) {
		ll x, y; cin >> x >> y;
		w[i] = { x,y };
		v.push_back({ x,y });
	}
	rep(i, m) {
		ll x, y; cin >> x >> y;
		b[i] = { x,y };
		v.push_back({ x,y });
	}
	rep(i, n + m) {
		rep(j, i) {
			ll dx = v[j].first - v[i].first;
			ll dy = v[j].second - v[i].second;
			vector<int> le, ri;
			vector<pair<LP, int>> z;
			rep(k, n) {
				ll difx = w[k].first - v[i].first;
				ll dify = w[k].second - v[i].second;
				int t = ccw({ dx,dy }, { difx,dify });
				if (t == -1)le.push_back(0);
				else if (t == 1)ri.push_back(0);
				else {
					z.push_back({ w[k],0 });
				}
			}
			rep(k, m) {
				ll difx = b[k].first - v[i].first;
				ll dify = b[k].second - v[i].second;
				int t = ccw({ dx,dy }, { difx,dify });
				if (t == -1)le.push_back(1);
				else if (t == 1)ri.push_back(1);
				else {
					z.push_back({ b[k],1 });
				}
			}
			sort(le.begin(), le.end());
			sort(ri.begin(), ri.end());
			sort(z.begin(), z.end());
			if (!le.empty() && le[0] != le.back())continue;
			if (!ri.empty() && ri[0] != ri.back())continue;
			if (!le.empty() && !ri.empty()) {
				if (le[0] == 0 && ri[0] == 0) {
					bool f = true;
					rep(k, z.size())if (z[k].second == 1)f = false;
					if (!f)continue;
				}
				if (le.back() == 1 && ri.back() == 1) {
					bool f = true;
					rep(k, z.size())if (z[k].second == 0)f = false;
					if (!f)continue;
				}
			}
			int cnt = 0;
			rep(i, (int)z.size() - 1) {
				if (z[i].second != z[i + 1].second)cnt++;
			}
			if (cnt > 1)continue;
			cout << "YES" << endl; return;
		}
	}
	cout << "NO" << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(10);
	//init();
	while (cin >> n>>m, n|m) {
		solve();
	}
	//solve();
	//stop
	return 0;
}



Measured memory_bytes: 3164
#include <stdio.h>
int main(void){
    
    double l,r;
    int la=0,lb=0,lc=0,ld=0,ra=0,rb=0,rc=0,rd=0;
    while(scanf("%lf %lf",&l,&r)!=EOF){
        if(l>=1.1){
            la++;
        }if(l<1.1&&0.6<=l){
            lb++;
        }if(l>=0.2&&0.6>l){
            lc++;
        }if(0.2>l){
            ld++;
        }
        if(r>=1.1){
            ra++;
        }if(r<1.1&&0.6<=r){
            rb++;
        }if(r>=0.2&&0.6>r){
            rc++;
        }if(0.2>r){
            rd++;
        }        
        
        
        
    }   
    
    printf("%d %d\n",la,ra);
    printf("%d %d\n",lb,rb);
    printf("%d %d\n",lc,rc);
    printf("%d %d\n",ld,rd);
}


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

//base:[Convex-Hull Trick - sataniC++](http://satanic0258.hatenablog.com/entry/2016/08/16/181331#fn-534591c8)
//追加する直線の傾きは単調（最小値なら傾きは単調減少、最大値なら傾きは単調増加）
template<typename T>
struct ConvecHullTrick {
  typedef pair<T,T> Line;
  vector<Line> lines; //直線（傾き，切片）
	bool isMonotonicX; //最小値(最大値)を求めるxが単調であるか
	function<bool(T l, T r)> comp; //最小/最大を判断する関数

	//flag:クエリは単調？　compFunc:求めるのは最大値？
	ConvecHullTrick(bool flagX=0,bool compFunc=0):isMonotonicX(flagX){
    if(compFunc)comp=[](T l,T r){return l<=r;};
    else comp=[](T l,T r){return l>=r;};
	};

	//直線l1,l2,l3のうちl2が不必要であるかどうか
	bool check(Line l1,Line l2,Line l3){
		if(l1<l3)swap(l1,l3);
    T a1=l1.first,a2=l2.first,a3=l3.first,b1=l1.second,b2=l2.second,b3=l3.second;
		return (b3-b2)*(a2-a1)>=(b2-b1)*(a3-a2);
	}

	//直線y=ax+bを追加する　単調性から付け足すのは一番後ろで、不必要なやつが消えるまで一番後ろを消したら付け足す
	void add(T a, T b) {
		Line line(a,b);
		while(lines.size()>=2&&check(*(lines.end()-2),lines.back(),line))lines.pop_back();
		lines.emplace_back(line);
	}

	//linesのi番目の直線のxでの値
	T f(int i,T x) {
		return lines[i].first*x+lines[i].second;
	}

	//特定のlineのxでの値
	T f(Line line,T x) {
		return line.first*x+line.second;
	}

	//直線群の中でxの時に最小(最大)となる値を返す
	T get(T x){
    assert(lines.size());
		if(isMonotonicX){//最小値(最大値)クエリにおけるxが単調（昇順）
			static int head=0;
			while(lines.size()-head>=2&&comp(f(head,x),f(head+1,x)))head++;
			return f(head,x);
		}
		else{
			int low=-1,high=lines.size()-1;
			while(high-low>1){
				int mid=(high+low)>>1;
				if(comp(f(mid,x),f(mid+1,x)))low=mid;
        else high=mid;
			}
			return f(high,x);
		}
	}
};
long long dp[223456];

int main(){
  long long n,c;cin>>n>>c;
  ConvecHullTrick<long long> CHT(1,0);
  for(int i=0;i<n;i++){
    long long h;cin>>h;
    long long res=0;
    if(i)res=CHT.get(h)+h*h+c;
    if(i==n-1)cout<<res<<endl;
    else CHT.add(-2*h,res+h*h);
  }
}


Measured memory_bytes: 6128
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
using namespace std;
int main(){
	cin.tie(0),cin.sync_with_stdio(0),cout.tie(0),cout.sync_with_stdio(0);
	string s;
	cin>>s;
	deque<char> d;
	for(int i=0;i<s.size();i++)
		d.push_back(s[i]);
	int q, flag=0;
	cin>>q;
	while(q--){
		int op;
		cin>>op;
		if(op==1)
			flag=1-flag;
		else{
			int where;
			char c;
			cin>>where>>c;
			where--;
			if(flag==1)
				where=1-where;
			if(where==0)
				d.push_front(c);
			else d.push_back(c);
		}
	}
	if(flag){
		for(int i=d.size()-1;i>=0;i--)
			cout<<d[i];
	}
	else{
		for(int i=0;i<d.size();i++)
			cout<<d[i];
		}
}


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

int main(){
  int n,q,ans=0;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);

  for(int i=0; i<n; i++){
    cin >> a[i];
    a[i]--;
  }
  for(int i=0; i<n; i++){
    cin >> b[i];
  }
  for(int i=0; i<n; i++){
    cin >> c[i];
  }

  for(int i=0; i<n; i++){
    ans+= b[a[i]];
    if( 0<i && a[i] == a[i-1]+1){
      ans+= c[a[i-1]];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			boolean bl = a < 10 && b < 10;
			if (bl) {
				System.out.println(a * b);
			} else {
				System.out.println(-1);
			}
		}
	}
}

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

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

	vector<int> cnt(S.size() - T.size() + 1, 0);
	rep(i, cnt.size()) {
		rep(j, T.size()) {
			if(S[i+j] != T[j]) cnt[i]++;
		}
	}

	int ans = 1001001;
	rep(i, cnt.size()) {
		ans = min(ans, cnt[i]);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
namespace cs
{
  class Program
  {
    static void Main(string[] args)
    {
      long mod = 1000000007;
      string[] input = Console.ReadLine().Split(' ');
      long a = long.Parse(input[0]);
      long b = long.Parse(input[1]);
      long ans = 1;
      while (0 < b) {
        if (b % 2 == 1) {
          ans *= a;
          ans %= mod;
        }
        b /= 2;
        a *= a;
        a %= mod;
      }
      Console.WriteLine(ans);
    }
  }
}



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

int main() {
  int n;
  double sum=0;
  cin >> n;
  for(int i=0;i<n;i++){
    double a;
    cin >> a;
    sum += 1.0/a;
  }
  cout << setprecision(10) << 1.0/sum << endl;
}

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

typedef long long ll;
typedef vector<ll> vi;

vi a,b;
int n;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    ll p,q;
    while(cin >> n)
    {
        a = vi(n);
        for(int i = 0; i < n; i++)
            cin >> a[i];
        b = vi(n);
        for(int i = 0; i < n; i++)
            cin >> b[i];
        p = q = 0;
        for(int i = 0; i < n; i++)
            if(a[i] > b[i])
                q += a[i]-b[i];
            else if(a[i] < b[i])
            {
                ll d = b[i] - a[i];
                if(d % 2 == 0)
                    p += d/2;
                else
                {
                    p += (d+1)/2;
                    q++;
                }
            }
        cout << (p >= q? "Yes" : "No") << '\n';
    }
    return 0;
}

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

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

  if(n==1){
    cout << 0 << endl;
    return 0;
  }
  if(n==2){
    cout << 2 << endl;
    return 0;
  }

  long long u = 1;
  long long v = 1;
  long long x = 1;
  for (long long i = 0; i < n; i++)
  {
    u*=10;
    v*=9;
    x*=8;
    u%=1000000007;
    v%=1000000007;
    x%=1000000007;
  }  

  long long ans = u-2*v+x+1000000007*2;
  ans %= 1000000007;
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<cstdio>
#include<cstring>

namespace interesting
{
	const int N=201000;
	bool t0[N*2],*f;
	int n,k;
	void initialize()
	{
		static char tmp[N];
		scanf("%d%d",&n,&k),scanf("%s",tmp+1);
		for(int i=1;i<=n;i++)t0[i]=tmp[i]=='A';
		f=t0;
	}
	bool tag;
	void work()
	{
		for(tag=0;k--;)
		{
			if(f[1]^tag)f[1]^=1;
			else f++,f[n]=tag,tag^=1;

			if(f-t0>n && k%2==0)return;
		}
	}
	void solve()
	{
		initialize();
		work();
		for(int i=1;i<=n;i++)printf("%c",f[i]^tag?'A':'B');printf("\n");
	}
}

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


Measured memory_bytes: 1024
N, D = [int(s) for s in input().split()]
X = []
Y = []

for _ in range(N):
    x, y = [int(s) for s in input().split()]
    X.append(x**2)
    Y.append(y**2)

distance = D**2

ans = 0
for x, y in zip(X, Y):
    if x + y <= distance:
       ans += 1

print(ans)

Measured memory_bytes: 24740
#include <stdio.h>
#define N 1001

int main(){
  int i,num,deal;
  int data1[N],data2[N];
  char buf[256];
  for (i=0;i<N;i++)
    data1[i]=data2[i]=0;

  while(strcmp(fgets(buf,256,stdin),"\n")){
    sscanf(buf,"%d,%d",&num,&deal);
    data1[num]++;
  }

  while(scanf("%d,%d",&num,&deal)!=EOF)
    data2[num]++;

  for (i=0;i<N;i++)
    if (data1[i]>0 && data2[i]>0)
      printf("%d %d\n",i,data1[i]+data2[i]);
  return 0;
}

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

int main() 
{
   string n; 
   cin >> n;
   int sum = 0;
   for(int i = 0; i < n.length(); i++) {
   		sum = (sum + (n[i]-'0'))%9; 
   }
   if(sum == 0) {
   	cout << "Yes";
   } else {
   	cout << "No";
   }
	return 0;
}


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

int main() {
    int n, z, w;
    cin >> n >> z >> w;
    vector<int> a(n);
    for(auto &e : a) cin >> e;
    int ans = abs(a[n - 1] - w);
    if(n > 1) ans = max(ans, abs(a[n - 2] - a[n - 1]));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
def check_odd(li):
    for i in li:
        if i % 2 != 0:
            return False
    return True


N = int(input())
A = [int(x) for x in input().split()]

ans = 0

while 1:
    if check_odd(A):
        A = list(map(lambda x: x / 2, A))
        ans += 1
    else:
        break
print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long x;
  cin >> x;
  if (!(x%11)) {
    cout << x/11*2;
  } else if (x%11 <= 6) {
    cout << x/11*2+1;
  } else {
    cout << x/11*2+2;
  }
}

Measured memory_bytes: 256
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    X = int(input())
    if X in [7, 5, 3]:
        print(YES)
    else:
        print(NO)


if __name__ == '__main__':
    main()


Measured memory_bytes: 4076
#include <iostream>
#include <string>
using namespace std;
typedef long long LL;
const int MAXN = 1e5 + 10;
struct TrieNode{
    bool end = false;
    LL deep = 0;
    TrieNode * nxt[2];
    TrieNode(int _deep) {
        deep = _deep;
        nxt[0] = nxt[1] = NULL;
    }
};
int n;
LL l, ret;

void add (TrieNode* root, string &s) {
    for (char c : s) {
        int p = c - '0';
        if (root->nxt[p] == NULL) root->nxt[p] = new TrieNode(root->deep+1);
        root = root->nxt[p];
    }
    root->end = true;
}
void solve(TrieNode *root) {
    if (root == NULL) return;
    if (root->deep == l) return;
    int cnt = 0;
    cnt += (root->nxt[0] != NULL);
    cnt += (root->nxt[1] != NULL);
    if (cnt == 0) return;
    if (cnt == 1) {
        LL val = l - root->deep;
        LL tmp = 1;
        while ((val&1) == 0) {
            val >>= 1;
            tmp <<= 1;
        }
        ret ^= tmp;
    }
    solve(root->nxt[0]);
    solve(root->nxt[1]);
}



int main() {
//    freopen("test.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);
    TrieNode *root = new TrieNode(0);
    cin >> n >> l;
    string s;
    for (int i = 0; i < n; i++) {
        cin >> s;
        add (root, s);
    }
    solve(root);
    if (ret > 0) cout << "Alice" << endl;
    else cout << "Bob" << endl;
    return 0;
}

Measured memory_bytes: 5840
n, k = map(int, input().split())
l = list(map(int, input().split()))
lo, hi = 1, 9999999999999999
while lo < hi:
    mid = (lo + hi) // 2
    cnt = 0
    for i in range(n):
        if l[i] % mid == 0: cnt += (l[i] // mid) - 1
        else: cnt += (l[i] // mid)
    if cnt <= k: hi = mid
    else: lo = mid + 1
print(lo)

Measured memory_bytes: 93900
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<random>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const ll inf = 4523372036854775807;
const ll Mod=1000000007;
short gh[2][4] = { {0,0,-1,1},{-1,1,0,0} };
struct P {
ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
ll to, cost;
};
struct S {//辺の情報を入れる変数
int from, to, cost;
};
struct H {
int x, y;
};
bool operator<(H a, H b) {
if (a.x != b.x) return a.x < b.x;
return a.y < b.y;
}
ll gcm(ll i, ll j) {//最大公約数
if (i > j) swap(i, j);
if (i == 0) return j;
return gcm(j%i, i);
}
ld rad(ld a, ld b, ld c, ld d) {
return sqrt(pow(a - c, 2) + pow(b - d, 2));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
if (b <= c || d <= a) return 0;
return 1;
}//[a,b),[c,d)
ll mod_pow(ll x,ll n,ll p){
    ll res=1;
    while(n>0){
        if(n&1) res=res*x%p;
        x=x*x%p;
        n>>=1;
    }
    return res;
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n,m,ans;
string s1,s2;
int dp[2001][2001][2];
int solve(int x,int y,int z){
	if(x==n&&y==m){
		if(z==0) return -inf;
		return 0;
	}
	if(dp[x][y][z]>0){
		return dp[x][y][z];
	}
	int sum=0;
	if(x<n){
		if(s1[x]=='O'&&z==1){
			sum=max(sum,solve(x+1,y,0)+1);
		}
		if(s1[x]=='I'&&z==0){
			sum=max(sum,solve(x+1,y,1)+1);
		}
	}
	if(y<m){
		if(s2[y]=='O'&&z==1){
			sum=max(sum,solve(x,y+1,0)+1);
		}
		if(s2[y]=='I'&&z==0){
			sum=max(sum,solve(x,y+1,1)+1);
		}
	}
	if(z==0&&sum==0){
		sum=-inf;
	}
	ans=max(ans,sum);
	return dp[x][y][z]=sum;
}
signed main() {
    cin>>n>>m;
    cin>>s1>>s2;
    for(int i=0;i<=n;i++){
		for(int j=0;j<=m;j++){		
			solve(i,j,0);
		}
	}
    cout<<ans<<endl;
    getchar(); getchar();
}



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

int main() {
    int H, W;
    cin >> H >> W;

    vector<char> pattern(2);
    pattern[0] = '#';
    pattern[1] = '.';

    while(!(H == 0 && W == 0)) {
        for(int i=0; i<H; ++i) {
            for(int j=0; j<W; ++j) {
                cout << pattern[(i+j)%2];
            }
            cout << endl;
        }
        cout << endl;

        cin >> H >> W;
    }

    return 0;
}


Measured memory_bytes: 3104
#!/usr/bin/env python3

n, m, x, y = list(map(int, input().split()))
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

x, y = min(x, y), max(x, y)

X, Y = max(X), min(Y)

x = max(X, x)
y = min(Y, y)

if x < y:
    print("No War")
else:
    print("War")


Measured memory_bytes: 9132
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;

int main(void){
	int N;
	cin >> N;
	int ans = 0;
	int A[N+1],B[N+1],C[N];
	for(int i=0;i<N;i++){
		cin >> A[i+1];
	}
	for(int i=0;i<N;i++){
		cin >> B[i+1];
	}
	for(int i=1;i<N;i++){
		cin >> C[i];
	}
	for(int i=1;i<=N;i++){
		ans += B[A[i]];
		if(A[i]+1 == A[i+1]){
			ans += C[A[i]];
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256