akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

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

	int N;
	ll A, B;
	cin >> N >> A >> B;
	vector<ll> X(N);
	REP(i, N) { cin >> X[i]; }
	ll res = 0;
	REP(i, N - 1) {
		res += min(B, (X[i + 1] - X[i]) * A);
	}
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(){
	char S, A, B;
	scanf("%s=c", &S, &A, &B);
	if(S, A != B){
		printf("Yes\n");
	}else if(S, B != A){
		printf("Yes\n");
	}else if(A, B != S){
		printf("Yes\n");
	}else if( S == A, A == B){
		printf("No\n");
	}
	return 0;
}

Measured memory_bytes: 1620
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;




public class Main {


    public static void main(String[] args) throws Exception {
        IO io = new IO(null, null);
        Stack<Character> ST = new Stack<>();
        for (char c : io.getNext().toCharArray()){
            if (c == 'T' && !ST.isEmpty() && ST.peek() == 'S') {
                ST.pop();
                continue;
            }
            ST.add(c);
        }
        io.println(ST.size());
        io.close();
    }
}



class IO{
    private BufferedReader br;
    private StringTokenizer st;
    private PrintWriter writer;
    private String inputFile,outputFile;

    public boolean hasMore() throws IOException{
        if(st != null && st.hasMoreTokens()) return true;
        if(br != null && br.ready()) return true;
        return false;
    }
    public String getNext() throws FileNotFoundException, IOException{
        while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public String getNextLine() throws FileNotFoundException, IOException{
        return br.readLine().trim();
    }

    public int getNextInt() throws FileNotFoundException, IOException{
        return Integer.parseInt(getNext());
    }
    public long getNextLong() throws FileNotFoundException, IOException{
        return Long.parseLong(getNext());
    }

    public void print(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f" ,x);
    }
    public void println(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f\n" ,x);
    }
    public void print(Object o) throws  IOException{
        writer.print(o.toString());
    }

    public void println(Object o) throws  IOException{
        writer.println(o.toString());
    }
    public IO(String x,String y) throws FileNotFoundException, IOException{
        inputFile = x;
        outputFile = y;
        if(x != null) br = new BufferedReader(new FileReader(inputFile));
        else br = new BufferedReader(new InputStreamReader(System.in));
        if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
        else writer = new PrintWriter(new OutputStreamWriter(System.out));
    }

    protected void close() throws IOException{
        br.close();
        writer.close();
    }
    public void outputArr(Object [] A) throws IOException{
        int L = A.length;
        for (int i = 0;i < L;i++) {
            if(i > 0) writer.print(" ");
            writer.print(A[i]);
        }
        writer.print("\n");
    }
}


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

int main(){
  
  int H, W;
  int sum = 0;
  cin >> H >> W;
  vector<vector<char>> grid(H, vector<char>(W, '.'));
  //配列に代入
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
    cin >>  grid.at(i).at(j); 
      
    }
  }
    
    //行成分の判別
  for(int i = 0; i < H; i ++){
    for(int j = 0, sum = 0; j < W; j++){
      
     //成分が「.」ならsumに＋１
      if(grid.at(i).at(j) == '.' ){
        sum += 1;
      }
      if(sum == W){
         for(int k = 0; k < W; k++){
           grid.at(i).at(k) = ' ';
           
        }
      }
    }
  }
  
  
	//列成分の判別
   for(int i = 0; i < W ; i++){
    for(int j = 0, sum = 0; j < H ; j++){
      
     //成分が「.」か空白ならsumに＋１
     if(grid.at(j).at(i) == '.'){
       sum += 1;
     }
      else if(grid.at(j).at(i) == ' '){
         sum += 1;
      }
      //列成分がすべて「.」なら空白を代入
      if(sum == H){
        for(int k = 0; k < H; k++){
         grid.at(k).at(i) = ' '; 
        }
      }
    }
  }
  
  //出力
 for(int i = 0;i < H ; i ++){
   for(int j = 0, sum =0; j < W; j++){
     //空白なら飛ばす
     if(grid.at(i).at(j) == ' '){
       sum += 1;
       if(j == W -1 && sum != W){
      cout << endl;
        }
        continue;
      }
      cout << grid.at(i).at(j);
     //最後の列になったら改行
     if(j == W - 1 && sum != W){
      cout << endl;
      }
    }
  }
}


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

int main(){
    int N; cin >> N;
    int a[200001];
    rep(i, N) cin >> a[i];

    // rep(i, N) cout << a[i] << endl;
    
    int maxv = 0;
    // cout << minv << endl;
    // maxv--;
    // cout << minv << endl;
    bool DuplicateFrag = 0;
    rep(i, N){
        
        if(maxv < a[i]) maxv = a[i];
    }
    int count = 0;
    rep(i, N) if(maxv == a[i]) count++;
    if(count > 1) DuplicateFrag = 1; 
    // cout << minv << endl;

    rep(i, N){
        if(DuplicateFrag){
            cout << maxv << endl;
        }
        else if(maxv == a[i]) {
            unsigned int maxv2 = 0;
            // minv2--;
            rep(j, N){
                if(j == i) ; 
                else{
                    if(maxv2 < a[j]) maxv2 = a[j];
                }
                
            }
            cout << maxv2 << endl;
        }
        else cout << maxv << endl;
    }

    return 0;
}

Measured memory_bytes: 2432
//============================================================================
// Name        : JOI.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;

int main() {

	char s1,s2,s3;
	int d=0;

	cin>>s1>>s2>>s3;

	if(s1=='1'){
		d++;

	}
	if(s2=='1'){
		d++;

	}
	if(s3=='1'){
		d++;

	}

	cout<<d<<endl;


}


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int N, A, B;

bool check(int n)
{
    int s = 0;
    while (n > 0)
    {
        s += n % 10;
        n /= 10;
    }
    return s >= A && s <= B;
}

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

    int s = 0;
    REP(n, N + 1)
    {
        if (check(n))
            s+=n;
    }
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

const char leftKey_[] = {'q', 'w', 'e', 'r', 't', 'a', 's', 'd', 'f', 'g', 'z', 'x', 'c', 'v', 'b'};
const std::set<char> leftKey(leftKey_, leftKey_ + sizeof(leftKey_) / sizeof(leftKey_[0]));

bool isLeft(const char c)
{
	return leftKey.find(c) != leftKey.end();
}

int main()
{
	std::string str;
	while (std::cin >> str, str != "#") {
		int n = 0;
		bool left = isLeft(*str.begin());
		for (std::string::iterator it = str.begin(); it != str.end(); ++it) {
			if (isLeft(*it) != left) {
				left = !left;
				++n;
			}
		}
		std::cout << n << std::endl;
	}
	return 0;
}

Measured memory_bytes: 0
while line = gets do
  a, b, c, d, e, f = line.split.map(&:to_i)
  ans1 = ((e*c-b*f)*1.0/(a*e-b*d)*1000).round/1000.0
  ans2 = ((a*f-d*c)*1.0/(a*e-b*d)*1000).round/1000.0
  printf("%.3f %.3f\n", ans1, ans2)
end

Measured memory_bytes: 2364
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

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


Measured memory_bytes: 256
/***
**   AUTHOR::ASHUTOSH MOUDGIL
***/


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

#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
#define F first
#define S second
#define int long long
//#define ll long long
#define all(x) x.begin(),x.end()
#define rsort(x) sort(all(x)); reverse(all(x));
#define endl '\n'
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define vi vector<int>
#define vlli vector<long long>
#define pii pair<int,int>
#define mod 1000000007
#define LMAX 1e18
#define deb(x) cout<<#x<<" : "<<x<<endl;
#define PI 3.141592654
#define dbg1(x) cout << #x <<"="<< x <<endl;
#define dbg2(x,y) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<endl;
#define dbg3(x,y,z) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<<endl;
#define dbg4(x,y,z,a) cout << #x <<"="<<x<<", "<<#y<<"="<<y <<", "<<#z<<"="<<z<< ", "<<#a <<"="<<a << endl;
#define dbgarr(x) cout << #x<<endl;for(int i : x){cout << i <<" ";} cout <<endl;



void mymain(){
    string s1;
    char* str = new char[1000001];
    cin >> s1;
    int q;
    cin >> q;
    int rev = 0;
    string pre,suf;
    int s = 100000,e=100000;
    for(int i=0;i<s1.size();i++){
        str[e] = s1[i];
        e++;
    }
    s--;
    while(q--){
        int x;
        cin >> x;
        if(x==1){
            rev^=1;
        }else{
            int y;char c;
            cin >> y >> c;
            if(y==1){
                if(rev){
                    str[e] = c;
                    e++;
                }else{
                    str[s] = c;
                    s--;
                }
            }else{
                if(rev){
                    str[s] = c;
                    s--;
                }else{
                    str[e]=c;
                    e++;
                }
            }
        }
    }
    string ans;
    if(rev){
        for(int i=e-1;i>s;i--)
            ans += str[i];
    }else{
        for(int i=s+1;i<e;i++)
            ans += str[i];
    }

    cout << ans << endl;

}

signed main(){
IOS;
///freopen("input.txt", "r", stdin);
///freopen("output.txt", "w", stdout);
int t=1;
//cin>>t;
for(int tt=0;tt<t;tt++){
   ///cout << "Case #" << tt+1 <<": ";
   mymain();
   }
return 0;
}
/*

*/


Measured memory_bytes: 1364
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
ll n,m;

int main(){
    cin>>n>>m;
    vector<int> l(m+10),r(m+10);
    for(int i=1;i<=m;i++){cin>>l.at(i)>>r.at(i);}
    int start=1;
    int end=n;
    for(int i=1;i<=m;i++){
        if(l.at(i)>start)start=l.at(i);
        if(r.at(i)<end)end=r.at(i);
    }
    int ans=end-start+1;
    cout<<max(ans,0)<<endl;
    return 0;
}




Measured memory_bytes: 1024
n,c,k=map(int,input().split())
t=[]
for i in range(n):
    t.append(int(input()))
t.sort()
ans=0
p=0
q=0
for i in range(n):
    if p==0:
        p=t[i]
        ans+=1
        q=i
    elif t[i]>p+k or i>=q+c:
        p=t[i]
        ans+=1
        q=i
print(ans)





Measured memory_bytes: 7384
# ABC076 C - Dubious Document 2
S=input()
T=input()
ls=len(S)
lt=len(T)

if lt>ls:
    print('UNRESTORABLE')
    exit()

if S.count(T)>0:
    S=S.replace('?','a')
    print(S)
    exit()

for i in range(ls-lt+1):
    NG_flg=False
    t_str=S[ls-lt-i:ls-i]
    for j,tt in enumerate(t_str):
        if tt==T[j:j+1] or tt=='?':
            pass
        else:
            NG_flg=True
            break
    if NG_flg==False:
        S=list(S)
        T=list(T)
        for k in range(lt):
            S[ls-lt-i+k:ls-lt-i+1+k]=T[k:k+1]
        break

if NG_flg==True:
    print('UNRESTORABLE')
    exit()

ans=''
for ss in S:
    ans+=ss
ans=ans.replace('?','a')

print(ans)


Measured memory_bytes: 3064
#include "bits/stdc++.h"
#pragma GCC optimize "03"
using namespace std;

#define int long long int
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define rep(i,a,b) for (int i = a; i < b; ++i)
#define dbg(x) { cerr<<"> "<<#x<<": "<<x<< endl; }
#define dbg2(x,y) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<endl; }
#define dbg3(x,y,z) { cerr<<"> "<<#x<<": "<<x<<" , "<<#y<<": "<<y<<" , "<<#z<<": "<<z<<endl; }
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#ifndef LOCAL
#define endl '\n'
#endif
const int inf = INT_MAX;
const double eps = 0.0000001;
const double PI = acos(-1.0);
const int MOD = 1e9+7;
const int N  = 1e5+5;

int a[N], dp[N];

signed main(){
    #ifdef LOCAL
        freopen("input.txt", "r", stdin);
        //freopen("output.txt", "w", stdout);
    #endif  
    IOS;

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

Measured memory_bytes: 1792
n = int(input())
abc = tuple(tuple(map(int, input().split())) for _ in range(n))

dp = [[0 for j in range(3)] for _ in range(n+1)]

for i in range(n):
    for k in range(3):
        dp[i+1][k] = max(dp[i][j] + abc[i][k] for j in range(3) if j != k)
    
print(max(dp[-1]))

Measured memory_bytes: 41748
n = gets.to_i
nums = gets.chomp.split.map(&:to_i)
sum = 1

if nums.include?(0)
  puts 0
else  
	nums.each do |num|
  		sum *= num.to_i
      	 if sum > 1e18
          puts -1 
          exit
         end
	end
	puts sum
end  

Measured memory_bytes: 23568
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int min(int a, int b){
	return a > b ? b : a;
}

int max(int a, int b){
	return a > b ? a : b;
}

int main(void){
	int n, k;
	int near = INT_MAX;
	int *x;
	scanf("%d %d", &n, &k);
	x = malloc(sizeof(int) * n);
	for(int i = 0; i < n; i++){
		scanf("%d", x + i);
		if(i >= k - 1){
			int left = i - k + 1, right = i;
			near = min(near, x[right] - x[left] + min(max(0, x[left]) - min(0, x[left]), max(0, x[right]) - min(0, x[right])));
		}
	}
	printf("%d\n", near);
	return 0;
}
	

Measured memory_bytes: 512
import math
import sys
from io import StringIO
import unittest
from functools import reduce

def resolve():
    k = int(input())

    abc = [0, 0, 0]
    ans = 0

    for i in range(1, k + 1):
        for j in range(k):

            abc[j] = i

            if 0 in abc:
                continue

            work = reduce(math.gcd, abc)
            if not abc[0] == abc[1] == abc[2]:
                work = work * 3
            ans += work
            print(str(abc) + "| " +str(work))

    print(ans)



def not_resolve2():
    k = int(input())

    ans = 0

    for a in range(1, k + 1):
        # print(a)
        for b in range(a, k + 1):
            for c in range(b, k + 1):
                work = reduce(math.gcd, [a, b, c])
                if a == b == c:
                    print("これは×3しない")
                    print(str(a) + "|" + str(b) + "|" + str(c) + "=" + str(work))
                    # ×3しない
                    pass
                else:
                    print("これは×3する")
                    print(str(a) + "|" + str(b) + "|" + str(c) + "=" + str(work * 3))
                    work = work * 3
                ans += work

    print(ans)


# これじゃダメ。タイムアウトする気がする・・。
def not_resolve():
    k = int(input())

    ans = 0

    for a in range(1, k + 1):
        for b in range(1, k + 1):
            for c in range(1, k + 1):
                ans += reduce(math.gcd, [a, b, c])

    print(ans)



class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """2"""
        output = """9"""
        self.assertIO(input, output)

    def test_入力例(self):
        input = """3"""
        output = """30"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """200"""
        output = """10813692"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    not_resolve()
    #not_resolve()


Measured memory_bytes: 78176
#include<iostream>
using namespace std;
int k,s,ans;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin>>k>>s;
    for(register int x=0;x<=k;x++)
    {
        for(register int y=0;y<=k;y++)
        {
            if(s-x-y>=0&&s-x-y<=k) ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n==25)cout<<"Christmas";
	if(n==24)cout<<"Christmas Eve";
	if(n==23)cout<<"Christmas Eve Eve";
	if(n==22)cout<<"Christmas Eve Eve Eve"; 
    return 0;
}

Measured memory_bytes: 256
import time
s = time.time()
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
S = np.array([list(map(int, input().split())) for i in range(D)])

last_day = np.zeros(26, dtype=int)

ans = []
for d in range(1, D+1):
    decrease = c * (d - last_day)
    sd = decrease.sum()
    diff = [S[d-1, i] - sd + decrease[i] for i in range(26)]
    choice = np.argmax(diff)
    ans.append(choice+1)
    last_day[choice] = d

def calc_pre(ans, pre_t, t, d):
    flag1 = flag2 = True
    res = [-1, -1]
    for day in range(d-1, -1, -1):
        td = ans[day]
        if td == pre_t and flag1:
            res[0] = day
            flag1 = False
        if td == t and flag2:
            res[1] = day
            flag2 = False
        if not (flag1 or flag2):
            return res
    return res

def calc_next(ans, pre_t, t, d):
    flag1 = flag2 = True
    res = [D, D]
    for day in range(d+1, D):
        td = ans[day]
        if td == pre_t and flag1:
            res[0] = day
            flag1 = False
        if td == t and flag2:
            res[1] = day
            flag2 = False
        if not (flag1 or flag2):
            return res
    return res

while time.time() - s < 1.9:
    d = np.random.randint(0, D, 1)[0]
    t = np.random.randint(1, 27, 1)[0]
    pre_t = ans[d]
    if pre_t == t:
        continue
    dm1, dm2 = calc_pre(ans, pre_t, t, d)
    dp1, dp2 = calc_next(ans, pre_t, t, d)
    diff = S[d, t-1] - S[d, pre_t-1] + c[pre_t-1]*(dm1-d)*(dp1-d) - c[t-1]*(dm2-d)*(dp2-d)
    if diff > 0:
        ans[d] = t

print(*ans, sep='\n')

Measured memory_bytes: 27544
[<EntryPoint>]
let main argv =
    let N = stdin.ReadLine() |> int
    let counter =
        [| for _ in 1..N -> 
            stdin.ReadLine().[0]
        |]
        |> Array.countBy id
        |> Array.filter (fun (c, _) -> "MARCH".Contains(c.ToString()))
        |> Array.map (fun (c, x) -> c, (int64 x))
    let n = counter |> Array.length
    if n < 3 then 0L
    else
        let counts a b c =
            List.fold (fun total i -> total * (snd counter.[i])) 1L [a; b; c]
        let rec dfs a b c count =
            if a >= n-2 then count
            elif b = n-2 then dfs (a+1) (a+2) (a+3) (count + (counts a b c))
            elif c = n-1 then dfs a (b+1) (b+2) (count + (counts a b c))
            else dfs a b (c+1) (count + (counts a b c))
        dfs 0 1 2 0L
    |> stdout.WriteLine
    0 // return an integer exit code


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

int main(){
  int N;
  cin >> N;
  int sum = 0;
  
  rep(i, N){
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  
  cout << sum << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>

using namespace std;

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

int main() {
  map<ii, ll> cc;
  ll h, w, n;
  scanf("%lld%lld%lld", &h, &w, &n);
  ll count[10]; memset(count, 0, sizeof count);
  ll sum = 0;
  for (int i = 0; i < n; i++) {
    ll a, b;
    scanf("%lld%lld", &a, &b);
    a--; b--;
    for (int j = -2; j <= 0; j++) {
      for (int k = -2; k <= 0; k++) {
        if (a+j >= 0 && b+k >= 0 && a+j+2 < h && b+k+2 < w) {
          int d = ++cc[ii(a+j, b+k)];
          if (d-1 == 0) {
            sum++;
          } else {
            --count[d-1];
          }
          ++count[d];
        }
      }
    }
  }
  count[0] = (h-3+1)*(w-3+1)-sum;
  for (int i = 0; i < 10; i++) {
    printf("%lld\n", count[i]);
  }
}


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


int main(){
  int64_t N;
  cin >> N;
  vector<int64_t> A(N),B(N);
  for(int64_t i=0;i<N;i++){
    cin >> A.at(i) >> B.at(i);
  }
  sort(A.begin(),A.end());
  sort(B.begin(),B.end());
  if(N%2==1){
    cout << B.at((N-1)/2)-A.at((N-1)/2)+1 << endl;
  }else{
    cout << B.at(N/2-1)+B.at(N/2)-A.at(N/2-1)-A.at(N/2)+1 << endl;
  }
  
}

Measured memory_bytes: 6428
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())

sys.setrecursionlimit(10 ** 9)


def main():
    a, b, c = MAP()

    if a + b + c >= 22: print("bust")
    else: print("win")


if __name__ == '__main__':
    main()


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;5
double dp[505][505];
int n;
double p[505];
double q[505];
double psum[505];
double qsum[505];

double search(int l, int r) {
    if(dp[l][r] != 0) return dp[l][r];
    if(l == r) {
        return dp[l][r] = 0;
    }
    dp[l][r] = 1e9;
    double total = qsum[r] - qsum[l-1] + psum[r] - psum[l];
    for(int x = l + 1; x <= r; x++) {
        double left = qsum[x-1] - qsum[l-1] + psum[x-1] - psum[l];
        double right = total - left - p[x];
        double now = (search(l, x - 1) + 1) * (left / total) + (search(x, r) + 1) * (right / total);
        dp[l][r] = min(dp[l][r], now);
    }
    return dp[l][r];
}

int main() {
    cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n;
    for(int i = 2; i <= n + 1; i++) cin >> p[i];
    for(int i = 1; i <= n + 1; i++) cin >> q[i];
    for(int i = 1; i <= n + 1; i++) psum[i] = psum[i-1] + p[i];
    for(int i = i; i <= n + 1; i++) qsum[i] = qsum[i-1] + q[i];
    cout << 1.0 + search(1, n+1) << endl;
    return 0;
}


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

int main() {
	int x;
	cin >> x;
	if(x<600) cout << "8" << endl;
	else if(x<800) cout << "7" << endl;
	else if(x<1000) cout << "6" << endl;
	else if(x<1200) cout << "5" << endl;
	else if(x<1400) cout << "4" << endl;
	else if(x<1600) cout << "3" << endl;
	else if(x<1800) cout << "2" << endl;
	else if(x<2000) cout << "1" << endl;
}

Measured memory_bytes: 3616
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
#define sort(a,n) qsort(a,n,sizeof(TYPE),cmp)
#define sort_r(a,n) qsort(a,n,sizeof(TYPE),cmp_r);
#define chsort(s,n) qsort(s,n,sizeof(char),cmp)
#define chsort_r(s,n) qsort(s,n,sizeof(char),char_cmp_r);
#define TYPE int
#define MEMSET(a) memset(a,0,sizeof(a))
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(TYPE *)a-*(TYPE *)b;
}
int cmp_r(const void *a,const void *b){
	return *(TYPE *)b-*(TYPE *)a;
}
int char_cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int char_cmp_r(const void *a,const void *b){
	return strcmp((char *)b,(char *)a);
}
void swap(int *a,int *b){
	int t=*a;
	*a=*b;
	*b=t;
}

int main(void){
	int n=in(),k=in(),x,i,ans=0;
	rep(i,n){
		x=in();
		ans+=min(x,k-x)*2;
	}
	print(ans);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main (){
    int N;
    scanf("%d",&N);
    if(N == 7 || N == 5 || N ==3 ){
        printf("YES");
    }else{
          printf("NO");
    }
    

    
   
}
 

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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int a[mx2][mx2];
int col[mx2], row[mx2];

int main()
{
    int h, w;
    cin >> h >> w;

    char c;
    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            cin >> c;
            if(c == '#')
                a[i][j] = 1, row[i] = 1, col[j] = 1;
        }
    }

    for(int i = 1; i <= h; i++){
        for(int j = 1; j <= w; j++){
            if(row[i] && col[j]){
                if(a[i][j])
                    cout << '#';
                else
                    cout << '.';
            }
        }
        if(row[i])
            cout << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
A, B = map(int, input(). split())
answer = None
flag = False
for i in range(1, 1009):
  
  if (A == (i*0.08)//1) and (B == (i*0.1)//1):
    answer = i
    print(answer)
    flag = True
   
    if flag:
        break
if answer is None:
  answer = -1
  print(answer)
    


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

class BIT {
	vector<int> d;
	int num;

public:
	BIT(int N) {
		num = N;
		d.resize(N + 1);
		fill(d.begin(), d.end(), 0);
	}

	void add(int p, const int x = 1) {
		while (p <= num) {
			d[p] += x;
			p += p & -p;
		}
	}

	int sum(int p) {
		int ans = 0;
		while (p) {
			ans += d[p];
			p ^= p & -p;
		}
		return ans;
	}
};

int main(void) {
	int num, i, j, a, n = 0;
	cin >> num;
	vector<int> ans(num + 1), k(num), d(num + 1);
	BIT bit(num);
	rep(i, num) {
		scanf("%d", &k[i]);
		scanf("%d", &d[k[i]]);
	}
	a = num;
	for (i = 1; i <= num; i++) {
		bit.add(d[i]);
		n++;
		if (bit.sum(a - n) == 0) {
			rep(j, n)
				ans[i - j] = n;
			a -= n;
			n = 0;
		}
	}
	rep(i, num) {
		cout << ans[k[i]] << "\n";
	}
	return 0;
}

Measured memory_bytes: 6424
r, c = map(int, input().split(' '))

matrix = []
total_cols = [0 for i in range(c+1)]

for i in range(r):
    rows  = list(map(int, input().split(' ')));

    total = sum(rows)
    rows.append(total)

    total_cols = [ total_cols[i] + x for i, x in enumerate(rows) ]

    matrix.append(rows)

matrix.append(total_cols)

for row in matrix:
    print(' '.join([str(i) for i in row]))

Measured memory_bytes: 7812
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lf;

ll A, B;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> A >> B;
    if (A >= 13) {
        cout << B << "\n";
    }
    else if (A >= 6) {
        cout << B/2 << "\n";
    }
    else {
        cout << 0 << "\n";
    }
    
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<stdlib.h>
using namespace std;
#define MAX_N 1000001

int main(){
	int *count;
	count=(int *)malloc(sizeof(int)*MAX_N);
	int cnt=0;
	bool *a;
	a= (bool *)malloc(sizeof(bool)*MAX_N);
	a[1]=true;

	for(int i=2;i<MAX_N;i++){
		count[i]=cnt;
		if(a[i])continue;
		cnt++;
		count[i]++;
		//int k=1;
		long int k=i;//i??\???????????????????????????
		while(i*k<MAX_N){
			a[i*k]=true;
			k++;
		}

	}

	int n;
	while(cin >> n){
		cout << count[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 7844
program name
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,a,b,c,d
    character(:),allocatable:: s

    read*, n,a,b,c,d
    allocate(character(n):: s)
    read*, s
    
    if (.not.(can_reach_the_goal(a,c) .and. can_reach_the_goal(b,d))) then
        print'(a)', 'No'
        stop
    end if

    if (c < d) then
        print'(a)', 'Yes'
        stop
    end if

    if (exist_jump_point(b,d)) then
        print'(a)', 'Yes'
    else
        print'(a)', 'No'
    end if

contains
recursive function can_reach_the_goal(ori,dest) result(ret)
    integer(int32):: ori, dest
    logical:: ret

    ret = .false.
    if (ori == dest)then
        ret = .true.
        return
    end if

    if (ori+1 <= n) then 
        if (s(ori+1:ori+1) == '.') ret = ret .or. can_reach_the_goal(ori+1,dest)
    end if

    if (ori+2 <= n) then
        if (s(ori+2:ori+2) == '.') ret = ret .or. can_reach_the_goal(ori+2,dest)
    end if    
end function

recursive function exist_jump_point(ori,dest) result(ret)
    integer(int32):: ori, dest
    logical:: ret

    ret = .false.
    if (ori > d) return
    if (s(ori-1:ori-1)=='.' .and. s(ori+1:ori+1)=='.')then
        ret = .true.
        return
    end if

    if (ori+1 <= n) then 
        if (s(ori+1:ori+1) == '.') ret = ret .or. exist_jump_point(ori+1,dest)
    end if

    if (ori+2 <= n) then
        if (s(ori+2:ori+2) == '.') ret = ret .or. exist_jump_point(ori+2,dest)
    end if    
end function

end program name

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

int main() {
    int A[3]; rep(i, 3) cin >> A[i];
    sort(A, A + 3);
    int ans = 0;
    if ((A[1] - A[0]) % 2 == 1) { A[1]--; ans += 1; }
    ans += (A[1] - A[0]) / 2;
    ans += A[2] - A[1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cctype>
#define INF 10000000
using namespace std;
bool debug=false;

int main(){
  int h,w;
  int x[105][105];
  char c;
  cin>>h>>w;
  for(int i=0;i<105;i++)for(int j=0;j<105;j++)x[i][j]=INF;

  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>c;
      if(c=='c'){
	int cnt=0;
	for(int k=j;k<w;k++){
	  x[i][k]=cnt;
	  cnt++;
	}
      }
    }
  }
  
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(x[i][j]==INF) cout<<-1;
      else cout<<x[i][j];
      if(j!=w-1)cout<<" ";
    }
    cout<<endl;
  }

  return 0;
}

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

int main() {
  string s[3];
  cin >> s[0] >> s[1] >> s[2];
  int turn = 0;
  string ans;
  
  while(1) {
    if (s[turn].empty()) {
      ans = turn + 'A';
      break;
    }
    int tmp = s[turn][0] - 'a';
    s[turn].erase(0, 1);
    turn = tmp;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream> 
#include <math.h>
using namespace std;
long long int H,W;

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

 	if(W==1||H==1) cout<<1<<endl;
	else if(W%2==0) cout<<W/2*H<<endl;
	else 
	{
		if(H%2==0)
			cout<<(W/2+1)*H/2+(W/2)*H/2<<endl;
		else
			cout<<(W/2+1)*(H/2+1)+(W/2)*(H/2)<<endl;
	}	

}

/*
int main()
{
	long double A,B,C;
	cin>>A>>B>>C;
	if((C-A-B)>0&&(C-A-B)*(C-A-B)>4*A*B)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
}*/

Measured memory_bytes: 3624
internal fun solve(input: String): String {
    val alphabets = listOf("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
    return alphabets[alphabets.indexOf(input)+1]
}

fun main(args: Array<String>) {
    var OUTPUT = ""

    val br = System.`in`.bufferedReader()

    OUTPUT += solve(br.readLine())
    print(OUTPUT)
}


Measured memory_bytes: 31824
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll a,b,c,x,y,ans,ans0,ans1,ans2;
  cin>>a>>b>>c>>x>>y;
  
  map<ll,ll> mp;
  mp[x]=a;
  mp[y]=b;
  
  ans0=a*x+b*y;
  ans1=c*2*min(x,y)+mp[max(x,y)]*abs(x-y);
  ans2=c*2*max(x,y);
  ans=min({ans0,ans1,ans2});
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = Integer.parseInt(stdin.nextLine());
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = Integer.parseInt(stdin.nextLine());

        int b = Arrays.stream(a).reduce((x, y) -> x ^ y).getAsInt();
        int ans = 0;
        for (int i = 35; i >= 0; i--) {
            if ((b & (1 << i)) == 0) continue;
            for (int j = 0; j < n; j++) {
                int k = a[j] ^ (a[j] - 1);
                if (k == (1 << (i + 1)) - 1) {
                    ans++;
                    b ^= k;
                    break;
                }
            }
        }

        System.out.println(b == 0 ? ans : -1);
    }
}


Measured memory_bytes: 95888
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll x,y;
  cin >> x >> y;
  if(x%y==0)cout << "-1" << endl;
  else cout << x << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char S[11];
	scanf("%s", S);

	int i, j, num[strlen(S) - 2], min;
	char tmp[5];

	for (i = 0; i < strlen(S) - 2; i++) {
		strncpy(tmp, S, 3);
		num[i] = abs(atoi(tmp) - 753);
//		printf("%d\n", num[i]);
		
		if (i == strlen(S) - 3)
			break;

		for (j = 0; j < strlen(S) - 1; j++) 
			S[j] = S[j + 1];
//		printf("%s\n", S);
	}

	min = num[0];
	for (i = 1; i < strlen(S) - 2; i++) {
		if (min > num[i])
			min = num[i];
	}

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

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#include <math.h> 
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n,ch[200010];
	cin>>n;
	for(ll i=0;i<n;i++){
		cin>>ch[i];
	}
	ll ans=1;
	ll ma=ch[0];
	for(ll i=1;i<n;i++){
		ll now=ch[i];
		if(now<=ma){
			ans++;
			ma=now;
		}
	}
	cout <<ans;
	// your code goes here
	return 0;
}

Measured memory_bytes: 5240
using System;
using System.Collections.Generic;
public class ABC125B {
    public static void Main() {
        int N, ans = 0;
        List<int> V = new List<int>();
        List<int> C = new List<int>();
        N = int.Parse(System.Console.ReadLine());
        string[] str = System.Console.ReadLine().Split(' ');
        foreach (string s in str) {
            V.Add(int.Parse(s));
        }
        str = System.Console.ReadLine().Split(' ');
        foreach (string s in str) {
            C.Add(int.Parse(s));
        }
        for(int i = 0; i < V.Count; i++) {
            int s = V[i] - C[i];
            if (s > 0) ans += s;
        }
        System.Console.WriteLine(ans);
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mod 100000007
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define FOR(i,k,n) for(int i=k;i<n+k;i++)
#define ALL(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(0);
#define deg(x) cout<<"--"<<x<<endl;
int II(){int q;scanf("%d",&q);return q;}
int dx[]={0,-1,0,1};
int dy[]={-1,0,1,0};
int dxx[]={0,-1,-1,-1,0,1,1,1};
int dyy[]={-1,-1,0,1,1,1,0,-1};
#define int ll
const int N=1000005;

void solve(){
	int n,m;cin>>n>>m;
	string s="";
	for(int i=1; i<=n; i++) s+='#';
	bool bo=0;
	for(int i=1; i<=m; i++){
		int x,y;cin>>x>>y;
		if(s[x-1]!='#' && s[x-1]!=(y+'0')){
			bo=1;
			break;
		}
		s[x-1]=(y+'0');
	}
	if(bo==1){
		cout<<-1<<endl;
		return;
	}
	for(int i=1; i<n; i++) if(s[i]=='#') s[i]='0';
	if(n==1){
		if(m==0){
			cout<<0<<endl;
			return;
		}else cout<<s<<endl;
	}else{
		if(s[0]=='#') s[0]='1';
		if(s[0]=='0'){
			cout<<-1<<endl;
			return;
		}
		cout<<s<<endl;
	}
}
 
main(){
   
    int tt; tt=1;
    int cas=1;
    while(tt--){
        //printf("Case %d: ",cas++);
        solve();
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i < (n); i++)

int gcd(int p, int q){//ユークリッドの互除法
    int r;
    while(q != 0){
        r = p % q;
        p = q;
        q = r; 
    }
    return p;
}

int main(){
    int k;
    cin >> k;
    k += 1;
    int ans = 0;
    int ma;
    rep1(i,k){
        rep1(j,k){
            rep1(l,k){
                ma = gcd(i, j);
                ma = gcd(ma, l);
                ans += ma;
            }
        }
    }
    cout << ans << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> nums(N);
  for (int i=0; i<N; i++) {
    cin >> nums[i];
  }
  
  int maxim = -1000;
  int minin = 10000000000;
  
  for (int i=0; i<N; i++) {
    if (nums[i] < minin) {
      minin = nums[i];
    }
    if (nums[i] > maxim) {
      maxim = nums[i];
    }
  }
  cout << maxim - minin <<endl;
}

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

int main() {
  int N , K;
  cin >> N >> K;
  vector<int> sunuke(N); //sunuke = {1,2,3,...,N}
  for (int i = 0; i < N; i++) {
    sunuke.at(i) = i + 1;
  }
  
  for (int i = 0; i < K; i++) {
    int di;
    cin >> di;
    vector<int> Ai(di);
    for (int j = 0; j < di; j++) {
      cin >> Ai.at(j);
      sunuke.at(Ai.at(j) - 1) = 0;
    }
  }
  
  int count = N;
  for (int i = 0; i < N; i++) {
    if (sunuke.at(i) == 0) {
      count--;
    }
  }
  
  cout << count << endl;
}  

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

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

using namespace std;

const int INF=1<<29;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

int h,w;
char B[50][51];

#define inv(d) (((d)+2)&3) // opposite direction

int dp[50][50][4][4][4][4][4][4][4];
int dfs(int i,int j,int k,int d0,int d1,int d2,int d3,int d4,int d5){
	int &res=dp[i][j][k][d0][d1][d2][d3][d4][d5];
	if(~res) return res;

	if(i==h-1 && j==w-1) res=0; // goal

	int y[6],x[6];
	y[0]=  i +dy[inv(d0)]; x[0]=  j +dx[inv(d0)];
	y[1]=y[0]+dy[inv(d1)]; x[1]=x[0]+dx[inv(d1)];
	y[2]=y[1]+dy[inv(d2)]; x[2]=x[1]+dx[inv(d2)];
	y[3]=y[2]+dy[inv(d3)]; x[3]=x[2]+dx[inv(d3)];
	y[4]=y[3]+dy[inv(d4)]; x[4]=x[3]+dx[inv(d4)];
	y[5]=y[4]+dy[inv(d5)]; x[5]=x[4]+dx[inv(d5)];

	rep(d,4){
		int ii=i+dy[d],jj=j+dx[d],kk=k;
		if(d==1 || d==2) kk--;
		if(kk<0) continue;
		if(0<=ii && ii<h && 0<=jj && jj<w && B[ii][jj]!='#'){
			bool vis=false;
			rep(l,6) if(ii==y[l] && jj==x[l]) vis=true;
			res=max(res,dfs(ii,jj,kk,d,d0,d1,d2,d3,d4)+(vis||B[ii][jj]=='.'?0:B[ii][jj]-'0'));
		}
	}

	if(res==-1) res=-INF;

	return res;
}

int main(){
	int k; scanf("%d%d%d",&h,&w,&k);
	rep(i,h) scanf("%s",B[i]);

	memset(dp,-1,sizeof dp);
	printf("%d\n",dfs(0,0,k,3,3,3,3,3,3));

	return 0;
}

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

int main(){
    int n;
    cin >> n;
    vector<char>s(n);
    rep(i,n)cin >> s[i];
    ll rcnt = 0,gcnt = 0,bcnt = 0;
    rep(i,n){
        if(s[i] == 'R')rcnt++;
        if(s[i] == 'G')gcnt++;
        if(s[i] == 'B')bcnt++;
    }
    ll x = rcnt*gcnt*bcnt;
    
    rep(j,n){
        rep(i,j){
            int k = j+(j-i);
            if(k < n){
                if(s[i] == s[j])continue;
                if(s[i] == s[k])continue;
                if(s[k] == s[j])continue;
                x--;
            }
        }
    }
    
    cout << x << endl;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cmath>
using namespace std;
long long  a[1000001],b[1000001],N,A,B,i;
int main()
{
    while(cin>>N>>A>>B)
    {
       for(i=1;i<=N;i++)
       {
           cin>>a[i];
       }
       b[1]=0;
       a[0]=0;
       for(i=2;i<=N;i++)
       {
           b[i]=min(b[i-1]+(a[i]-a[i-1])*A,b[i-1]+B);
       }
       cout<<b[N]<<endl;
    }
    return 0;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int n;
    while(scanf("%d",&n),n){
        int stage[100000] = {0};
        for(int i = 1;i <= n; i++){
            scanf("%d",&stage[i]);
        }
        int x = 0;
        int ans = -1000000;
        for(int i = 1;i <= n; i++){
            for(int j = i;j <= n; j++){
                x += stage[j];
                ans = max(ans,x);
            }
            x = 0;
        }
        printf("%d\n",ans);
    }
    return 0;
}

Measured memory_bytes: 1424
#include<bits/stdc++.h>
using namespace std;
int n,m,x;
int a[50],b[50];
int dp[50][(1<<16)];

int main(){
  while(1){
    scanf("%d %d",&n,&m);
    if(n==0&&m==0)break;
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++){
      a[i]=0;
      for(int j=0;j<16;j++){
        scanf("%d",&x);
        a[i]=a[i]*2+x;
      }    
    }
    for(int i=0;i<m;i++){
      b[i]=0;
      for(int j=0;j<16;j++){
        scanf("%d",&x);
        b[i]=b[i]*2+x;
      }    
    }
    
    dp[0][0]=0;
    for(int i=0;i<n;i++){
      for(int j=0;j<(1<<16);j++){
        if(dp[i][j]==-1)continue;        
        for(int k=0;k<m;k++){
          int S=(j|a[i]|b[k])-b[k];
          int cost=__builtin_popcount( (j|a[i])&b[k] );
          dp[i+1][S]=max(dp[i+1][S],dp[i][j]+cost);         
        }        
      }
    }
    int ans=0;
    for(int i=0;i<(1<<16);i++)ans=max(ans,dp[n][i]);
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 14020
#include <stdio.h>

int main()
{
	int n;
	scanf("%d", &n);
	int array[100+10];
	for(int i = 0; i < n ; i++)
	{
		scanf("%d", &array[i]);
	}
	for(int i = n-1; i >= 0 ; i--)
	{
		printf("%d", array[i]);
		
		if(i != 0)
		{
			printf(" ");
		}
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <algorithm>
#include <complex>
#include <string>
#include <vector>

using namespace std;

int main() {

  string s;

  cin >> s;

  for (int i = 0; i < s.size(); i++) {
    if ((i+1) % 2 != 0) {
      cout << s[i];
    }
  }

  cout << endl;

  return 0;
}


Measured memory_bytes: 512
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int w, a, b;
	cin >> w >> a >> b;
	if (a == b)
		print(0);
	else if (a < b)
		print(max(b - (a + w), 0));
	else
		print(max(a - (b + w), 0));
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

int main(){
  int N,K;
  cin >>N>>K;
  
  vector<int> l(N);
  rep(i,0,N) cin >>l.at(i);
  
  sort(l.begin(),l.end(),greater<int>());
  
  int ans = 0;
  rep(i,0,K) ans += l.at(i);
  
  cout <<ans<< endl;
}

Measured memory_bytes: 256