akhauriyash/Code-Regression huggingface dataset:
# Algorithms and Data Structures 1
# Linear Search
# Name: Ryuya Asada
# ID: s1260064


def linear_search(A: list, key: int) -> int:
    i = 0
    # 番兵にkeyを追加
    A.append(key) 

    while A[i] != key:
        i += 1
        if i == len(A)-1:
            return -1

    return i

def main():
# Read first Array
    number_of_A = int(input())
    A = [int(a) for a in input().split(" ")]

# Read second Array
    number_of_B = int(input())
    B = [int(b) for b in input().split(" ")]

    num = 0
    for b in B:
        result = linear_search(A, b)
        if result != -1:
            num += 1

    print(num)


if __name__ == "__main__":
    main()



Measured memory_bytes: 6336
#include<stdio.h>
int main()
{
	int T=1,X,Y,Z,i,t,sort[3];
	//scanf("%d",&T);
	for(i=0;i<T;i++)
	{
		scanf("%d%d%d",&X,&Y,&Z);
		if(X>Y)
		{
			t=X;
			X=Y;
			Y=t;
		}
		if(Y>Z)
		{
			t=Y;
			Y=Z;
			Z=t;
		}
		if(X>Y)
		{
			t=X;
			X=Y;
			Y=t;
		}
		if((Z-X)%2==0 && (Z-Y)%2==0)
		{
			printf("%d\n",(Z-X)/2+(Z-Y)/2);
		}
		else if((Z-X)%2==1 && (Z-Y)%2==0 || (Z-X)%2==0 && (Z-Y)%2==1)
		{
			printf("%d\n",(Z-Y)/2+(Z-X)/2+2);
		}
		else
		{
			printf("%d\n",(Z-Y)/2+(Z-X)/2+1);
		}
	}
	return 0;
}


Measured memory_bytes: 128
N = list(input())
N_int = [int(n) for n in N]
cnt = 0

for i in range(len(N_int)-1):
    if N_int[i+1] != 9:
        N_int[i] -= 1
        for j in range(i+1, len(N_int)):
            N_int[j] = 9

for i in N_int:
    cnt += int(i)

print(cnt)

Measured memory_bytes: 9172
[l, r] = [int(i) for i in input().split()]

if (r - l >= 673):
    print(0)
else:
    a = 2018
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            b = i % 2019
            c = j % 2019
            d = (b * c) % 2019
            a = min(a, d)
    print(a)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int inf=1<<30;
#define rep(i,n)for(ll i=0;i<n;++i)
int main(){
int n,ct=0,ct2=0,a;
cin>>n;
rep(i,n){
cin>>a;
if(a%4==0)++ct;
if(a%2)++ct2;
}
if(n-ct-ct2)cout<< (ct>ct2-1?"Yes":"No")<<endl;
else cout<<(ct>=ct2-1?"Yes":"No")<<endl;
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
const ll M=1e9+7;
ll factorial[300005];
ll iFactorial[300005];
pair<ll,ll>arr[3005];
ll memo[3005];

ll fastExpo(ll x,ll p){
    ll ret=1;
    
    while(p){
        if(p&1){
            ret=(ret%M*x%M)%M;
        }
        x=(x%M*x%M)%M;
        p>>=1;
    }
    
    return ret%M;
}

void getFactorial(){
    factorial[0]=1;
    for(int i=1;i<=200005;i++){
        factorial[i]=(factorial[i-1]%M * i%M)%M;
    }
    for(int i=0;i<=200005;i++){
        iFactorial[i]=fastExpo(factorial[i],M-2)%M;
    }
    
}

ll ncr(ll n,ll r){
    return (factorial[n]%M*(iFactorial[n-r]%M * iFactorial[r]%M)%M)%M;
}



int main(){
    getFactorial();
    memset(memo,-1,sizeof(memo));
    ll r,c,q;
    scanf("%lld %lld %lld",&r,&c,&q);
    for(int i=1;i<=q;i++){
        scanf("%lld %lld",&arr[i].fi,&arr[i].se);
    }
    arr[0].fi=1;
    arr[0].se=1;
    arr[q+1].fi=r;
    arr[q+1].se=c;
    sort(arr,arr+q+2);
    
    // for(int i=1;i<=q;i++){
    //     printf("%lld-%lld\n",arr[i].fi,arr[i].se);
    // }
    memo[0]=0;
    ll ans=0;
    for(int i=1;i<=q+1;i++){
        ll dr=(arr[i].fi-arr[0].fi);
        ll dc=(arr[i].se-arr[0].se);
        ll temp=ncr(dr+dc,dc)%M;
        for(int j=1;j<i;j++){
            if(arr[i].fi<arr[j].fi || arr[i].se<arr[j].se) continue;
            temp=((temp%M-(memo[j]%M*ncr(arr[i].fi-arr[j].fi + (arr[i].se-arr[j].se),arr[i].se-arr[j].se)%M)%M)+M)%M;
        }
        
        memo[i]=temp%M;
    }
    printf("%lld\n",memo[q+1]);
    
}

Measured memory_bytes: 3968
//Pantyhose(black) + glasses = infinity

#include <bits/stdc++.h>
using namespace std;
 
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"

int main() {
	#ifdef GLASSES_GIRL
		freopen(FILE_NAME".inp", "r", stdin);
		freopen(FILE_NAME".out", "w", stdout);
	#endif
	ios::sync_with_stdio(0); cin.tie(0);
	int n;
	bool ok = false;
	cin >> n;
	for (int i=1; i<=n; ++i) {
		int x;
		cin >> x;
		if (x%2)
			ok = true;
	}
	if (ok)
		cout << "first";
	else
		cout << "second";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const int64_t LINF=8931145141919364364,LMOD=998244353;
// const int dy[]={0,-1,0,1,1,-1,-1,1};
// const int dx[]={1,0,-1,0,1,1,-1,-1};

int main() {
	int a, b; cin>>a>>b;
	if(a-b==0){
		cout<<0<<endl;
	}else{
		int k=a+b;
		if(k%2==1){
			cout<<"IMPOSSIBLE"<<endl;
		}else{
			cout<<k/2<<endl;
		}
	}
	return 0;
}

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

int main() {
    int N,K;
    cin >> N >> K;
    int m = 1;
    int l = 0;
    while(m<K){
        m = m*2;
        l++;
    }
    // 分母はN*(2^l)
    double x = 0; // 分子

    for (int i = 1; i < N+1; ++i) {
        int j = i;
        int k = 0;
        while(j<K){
            j = j*2;
            k++;
        }
        x = x + pow(2, l-k);
    }
    double ans = x / ( N * pow(2, l) );
    cout << setprecision(15) << ans;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.lang.Math;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
  		
      	int n = sc.nextInt();
      	long as[] = new long[n];
      	int stack;
		boolean neq = true;
      
      	for(int i = 0;i < n;i++){
        	as[i] = sc.nextInt(); 
        } 
      	Arrays.sort(as);
      	for(int i = 0;i < n-1 && neq;i++){
        	if(as[i] == as[i+1]) neq = false; 
        } 
       	
      	if(neq) System.out.println("YES");
      	else System.out.println("NO");
        
	}
}


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

#define MAX 2000000

// 1 originとして使う
int heap[MAX*2+1];
int H = 0;

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

void maxHeapify(int i){
  int l = left(i);
  int r = right(i);
  int largest;

  if(l <= H && heap[i] < heap[l]) largest = l;
  else largest = i;
  if(r <= H && heap[largest] < heap[r]) largest = r;

  if(largest != i){
    swap(heap[i], heap[largest]);
    maxHeapify(largest);
  }
}

void buildMaxHeap(){
  for(int i=H/2; i>0; i--){
    maxHeapify(i);
  }
}

void insert(int key){
  H++;
  heap[H] = key;

  int idx = H;
  while(heap[idx] > heap[parent(idx)] && parent(idx) > 0){
    swap(heap[idx], heap[parent(idx)]);
    idx = parent(idx);
  }
}

int extractMax(){
  int ret = heap[1];
  heap[1] = heap[H--];
  maxHeapify(1);
  return ret;
}

int main(){

  char c[10];
  int key;

  while(1){
    scanf("%s",c);

    switch(c[2]){
      case 's':
      scanf("%d", &key);
      insert(key);
      break;

      case 't':
      printf("%d\n",extractMax());
      break;

      case 'd':
      default:
      return 0;
      break;
    }
  }

  return -1;
}



Measured memory_bytes: 7068
#include <stdio.h>
int main(void){
    // Your code here!
    int i, j, tmp,a;
    int number[3];
    
    for (i=0; i<3; ++i){
        scanf("%d", &number[i]);
    }
    
    for (i=0; i<3; ++i) {
        for (j=i+1; j<3; ++j) {
            if (number[i] > number[j]) {
                tmp =  number[i];
                number[i] = number[j];
                number[j] = tmp;
            }
        }
    }

    a = abs(number[0]-number[1]) + abs(number[1]-number[2]);
    
    printf("%d",a);
    
    return 0;
}


Measured memory_bytes: 128
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';

int cnt[200003],n,k;
long long ans;
map<int,int>mp;

int main(void) {
    cin>>n>>k;
    rep(i,n){
        cin>>cnt[i+1];
        cnt[i+1]+=cnt[i]-1;
        cnt[i+1]%=k;
    }
    mp[0]=1;
    rep(i,n) {
        if (i+1>=k)mp[cnt[i+1-k]]--;
        ans+=mp[cnt[i+1]], mp[cnt[i+1]]++;
    }
    cout<<ans;
}

Measured memory_bytes: 10368
package main

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

const mod = 1000000007

func main() {
	stdin.Split(bufio.ScanWords)
	N := getStdin()
	length := make([]int, N)
	totalLength := 0
	x, y := 0, 0

	A := make([]int, N)
	for i:= 0; i < N; i++{
		A[i] = getStdin()
		totalLength += A[i]
	}
	for i:= 0; i < N; i++{
		if(i==0){
			length[i] = A[i]
		}else{
			length[i] = A[i] + length[i-1]
		}
		if(i == N-2){
			fmt.Println(int(math.Abs(float64(totalLength - 2 * (length[i])))))
			return
		}
		if(totalLength/2 <= length[i]){
			x = 2 * length[i] - totalLength
			y = totalLength - 2 * length[i-1]
			if(x >= y){
				fmt.Println(y)
			}else{
				fmt.Println(x)
			}
			return
		}
	}


}

var stdin = bufio.NewScanner(os.Stdin)

func getStdin() int {
	stdin.Scan()
	if err := stdin.Err(); err != nil {
		fmt.Fprintln(os.Stderr, err)
	}
	line, err := strconv.Atoi(stdin.Text())
	if err != nil {
		panic(err)
	}
	return line
}

func getStd() string {
	stdin.Scan()
	if err := stdin.Err(); err != nil {
		fmt.Fprintln(os.Stderr, err)
	}
	line := stdin.Text()
	return line
}

//Combination:b+cCc
func factorial(b int, c int) int {
	var sum, csum, bsum = 1, 1, 1
	for j := 0; j < c; j++ {
		csum = (csum * (c - j)) % mod
		bsum = (bsum * (b + c - j)) % mod
	}
	sum = div(bsum, csum)
	return sum
}

func mul(a int, b int) int {
	return ((a % mod) * (b % mod)) % mod
}

func div(a int, b int) int {
	return mul(a, power(b, mod-2))
}

func power(x int, y int) int {
	if y == 0 {
		return 1
	}
	if y == 1 {
		return x % mod
	}
	a := power(x, y/2) % mod
	if y%2 == 0 {
		b := a * a % mod
		return b
	}
	b := ((a * a) % mod) * x % mod
	return b
}


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

int main(){
    int N, M;
    cin >> N >> M;
    unordered_map<int, pair<bool, int>> m{};
    int wa_cnt = 0;
    int ac_cnt = 0;
    for(int i = 0; i < M; i++ ){
        int num;
        string result;
        cin >> num >> result;
        if(!m.count(num)==0){
            m.emplace(num, make_pair(false, 0)); 
        }

        if(m[num].first == false && result == "WA"){
            m[num].second++;
        }
        else if (m[num].first == false && result == "AC"){
            m[num].first = true;
            wa_cnt += m[num].second;
            ac_cnt++;
        }
    }
    cout << ac_cnt << " " << wa_cnt << endl;
}


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

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;

int main() {
    string S, T;
    cin >> S >> T;
    
    int len = S.size();
    
    for(int i=len-T.size(); i>=0; i--){
        bool f=true;
        rep(j,T.size()){
            if( S[i+j]=='?' || S[i+j]==T[j] ) continue;
            else { f=false; break; }
        }
        if(f){
            S.replace(i,T.size(),T);
            rep(i,S.size()){
                if(S[i]=='?') cout<<"a";
                else cout<<S[i];
            }
            cout<<endl;
            return 0;
        }
    }
    cout << "UNRESTORABLE" << endl;
}

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

int main(void){
	string S;
	cin >> S;
	int n,s,e,w;
	n = s = e = w = 0;
	for(int i=0;i<S.size();i++){
		if( S[i] == 'N' )n++;
		else if( S[i] == 'S' )s++;
		else if( S[i] == 'E' )e++;
		else if( S[i] == 'W' )w++;
	}

	if( s > 0 && n == 0 || s == 0 && n > 0 ||
		e > 0 && w == 0 || e == 0 && w > 0 )
		cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll=long long;
using P=pair<int,int>;
int main(){
  string s;
  cin >> s;
  int ans=0;
  if(s=="RRR") ans=3;
  if(s=="RRS") ans=2;
  if(s=="RSR") ans=1;
  if(s=="RSS") ans=1;
  if(s=="SRR") ans=2;
  if(s=="SRS") ans=1;
  if(s=="SSR") ans=1;
  if(s=="SSS") ans=0;
  cout << ans << endl;
  return 0;
}


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

int main() {
  const long inf = 1l << 62;
  int n, m;
  cin >> n >> m;
  vector<long> d(n + 1, inf);
  d.at(1) = 0;
  vector<vector<pair<int, long>>> to(n + 1);
  for (int i = 0; i < m; i++) {
    int l, r, c;
    cin >> l >> r >> c;
    to.at(l).emplace_back(r, c);
  }
  for (int i = 2; i < n; i++) {
    to.at(i).emplace_back(i - 1, 0);
  }
  priority_queue<pair<long, int>> q;
  q.emplace(0, 1);
  while (!q.empty()) {
    auto t = q.top();
    q.pop();
    int current = t.second;
    for (auto next : to.at(current)) {
      if (d.at(current) + next.second < d.at(next.first)) {
        d.at(next.first) = d.at(current) + next.second;
        q.emplace(-d.at(next.first), next.first);
      }
    }
  }
  if (d.at(n) == inf) {
    cout << -1 << endl;
    return 0;
  }
  cout << d.at(n) << endl;
}


Measured memory_bytes: 9340
#include <bits/stdc++.h>
 
#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()

using namespace std;

template <typename T>
class Mat
{
    vector<vector<T>> mat;
    int rows, columns;
public:
    Mat<T>(int r, int c) : rows(r), columns(c) {
        mat = vector<vector<T>>(rows, vector<T>(columns));
    }

    Mat<T>(initializer_list<initializer_list<T>> _mat) : rows(_mat.size()), columns(_mat.begin()->size()){
        mat = vector<vector<T>>(rows, vector<T>(columns));
        int i = 0;
        for (auto&& row : _mat) {
            copy(row.begin(), row.end(), mat[i++].begin());
        }
    }

    vector<T> &operator[](int m) {
        return mat[m];
    }

    void debug() {
        printf("r: %d, c: %d\n", rows, columns);
        loop (rows, r) {
            loop (columns, c) {
                cout << mat[r][c] << " ";
            }
            cout << endl;
        }
    }

    vector<T> operator*(vector<T> v) {
        auto ret = vector<T>(rows);
        for (int m = 0; m < rows; m++) {
            T sum = 0;
            for (int n = 0; n < columns; n++) {
                sum += mat[m][n] * v[n];
            }
            ret[m] = sum;
        }
        return ret;
    }

    Mat<T> &t() {
        auto _mat = vector<vector<T>>(columns, vector<T>(rows));
        for (int m = 0; m < rows; m++) for (int n = 0; n < columns; n++) {
            _mat[n][m] = mat[m][n];
        }
        mat = _mat;
        swap(rows, columns);
        return *this;
    }
};

void normalize(vector<int> &x, vector<int> &y)
{
    for (int i = x.size()-1; i >= 0; i--) {
        x[i] -= x[0], y[i] -= y[0];
    }

    vector<Mat<int>> D(4, Mat<int>(2, 2));
    D[0] = Mat<int>({{ 1, 0 }, { 0, 1 }});
    D[1] = Mat<int>({{ 0, 1 }, { -1, 0 }});
    D[2] = Mat<int>({{ -1, 0 }, { 0, -1 }});
    D[3] = Mat<int>({{ 0, -1 }, { 1, 0 }});

    // auto www = Mat<int>({{ 1, 0 }, { 0, 1 }});
    // www.debug();
    // for (auto&& v : D) v.debug();

    int d = 0;
    if (y[1] > 0) d = 1;
    if (x[1] < 0) d = 2;
    if (y[1] < 0) d = 3;

    loop (x.size(), i) {
        auto a = D[d] * vector<int>({ x[i], y[i] });
        x[i] = a[0];
        y[i] = a[1];
    }
}

int main()
{
    while (1) {
        int n; cin >> n;
        if (!n) break;
        int m; cin >> m;
        vector<int> orig_x(m), orig_y(m);
        loop (m, i) cin >> orig_x[i] >> orig_y[i];
        normalize(orig_x, orig_y);

        loop (n, i) {
            cin >> m;
            vector<int> x(m), y(m);
            loop (m, j) cin >> x[j] >> y[j];
            normalize(x, y);

            loop (2, k) {
                if (orig_x.size() == x.size()) {
                    bool ng = 0;
                    loop (x.size(), j) {
                        ng = ng || !(x[j] == orig_x[j] && y[j] == orig_y[j]);
                    }
                    if (!ng) {
                        cout << i+1 << endl;
                        break;
                    }
                }

                reverse(all(x));
                reverse(all(y));
                normalize(x, y);
            }
        }
        cout << "+++++" << endl;
    }
    return 0;
}

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

int main() {
	//おまじない
	cin.tie(0);
	ios::sync_with_stdio(false);
	

	ll N, M, x[1000], y[1000], z[1000];
	cin >> N >> M;
	rep(i, N) {
		cin >> x[i] >> y[i] >> z[i];
	}

	ll saidai = -1e18;


	rep(ii, 8) {
		ll x2[1000], y2[1000], z2[1000];
		rep(i, N) {
			x2[i] = (1 - 2 * (ii >> 0 & 1)) * x[i];
			y2[i] = (1 - 2 * (ii >> 1 & 1)) * y[i];
			z2[i] = (1 - 2 * (ii >> 2 & 1)) * z[i];
		}
		ll goukei[1000];
		rep(i, N) goukei[i] = x2[i] + y2[i] + z2[i];
		sort(goukei, goukei + N);
		ll goukei2 = 0;
		for (int i = N - 1; i > N - M - 1; i--) goukei2 += goukei[i];
		saidai = max(saidai, goukei2);
	}

	cout << saidai << "\n";

	Would you please return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cmath>
#include <stack>
#include <queue>
#include <map>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define UNIQUE(v) v.erase(unique(all(v)),v.end());
#define fill(a,x) memset(a,x,sizeof(a))
#define zero(a) fill(a,0)
#define minus(a) fill(a,-1)
#define dbg(x) cout << #x"=" << x << endl

const int INF=INT_MAX/3;
const int LIMIT=100;

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

int n;
string s;
int ans;

int main(){
    cin>>s;
    if((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3])) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
  int i,j,n,count=0;
  int A[101][101],B[101],C[101],D[101],a,ii;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&A[i][j]);
    }
  }

  for(i=0;i<n;i++){
    B[i]=0;
    D[i]=-1;
    C[i]=2001;
  }
  C[0]=0;

  while(1){
    a=2001;
    for(i=0;i<n;i++){
      if(B[i]!=2 && C[i]<a){
        a=C[i];
        ii=i;
      }
    }
    if(a==2001)break;
    B[ii]=2;
    for(i=0;i<n;i++){
      if(A[ii][i]!=-1 && B[i]!=2 && A[ii][i]<C[i]){
	D[i]=ii;
	C[i]=A[ii][i];
	B[i]=1;
      }
    }
  }

  for(i=0;i<n;i++){
    if(D[i]!=-1)count+=A[i][D[i]];
    }
  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int a,b,c;
cin >> a >> b >> c;
int ans = a+b+c;
if(a<=b&&c<=b) {
  cout << ans-b << endl;
} else if(a<=c&&b<=c) {
  cout << ans-c << endl;
} else {
  cout << ans-a << endl;
}
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int X = sc.nextInt();
        int y = X % 100;
        int max = X / 100 + 1;
        int a = 0;
        int b = 1;
        int c = 2;
        int d = 3;
        int e = 4;
        int f = 5;
        int sum = 0;
        int sum2 = 0;

        if (y == 0) {
            System.out.println(1);
            return;
        }
//        System.out.println("y = " + y);
        for (int i = y; i >= 0; i--) {
            sum = 0;
            sum2 = 0;
            sum = b * i;
            sum2 += i;
            for (int j = y - (b * i); j >= 0; j--) {
                sum += c * j;
                sum2 += j;
                for (int k = y - (b * i + c * j); k >= 0; k--) {
                    sum += d * k;
                    sum2 += k;
                    for (int l = y - (b * i + c * j + d * k); l >= 0; l--) {
                        sum += e * l;
                        sum2 += l;
                        for (int m = y - (b * i + c * j + d * k + e * l); m >= 0; m--) {
                            sum += f * m;
                            sum2 += m;
//                            System.out.println(sum);
//                            System.out.println(sum2);
//                            System.out.println(sum2 * 100 + y);
                            if (sum == y && sum2 * 100 + y <= X) {
                                System.out.println(1);
                                return;
                            }

                            sum -= f * m;
                            sum2 -= m;
                        }

                        sum -= e * l;
                        sum2 -= l;
                    }
                    sum -= d * k;
                    sum2 -= k;
                }
                sum -= c * j;
                sum2 -= j;
            }
            sum -= b * i;
            sum2 -= i;
        }

        System.out.println(0);


    }
}

Measured memory_bytes: 23124
/* ex 7_1
   YSK722 */

#include <stdio.h>

typedef struct point{  // xy座標
    int x_elem;
    int y_elem;
}point;

point shift_point(point vertice1, point vertice2);  // プロトタイプ宣言

int main(void){
    point vertice1, vertice2, vertice3, vertice4;
    scanf(
        "%d %d %d %d", &vertice1.x_elem, &vertice1.y_elem,
        &vertice2.x_elem, &vertice2.y_elem
    );
    // 反時計回りに順にvertice3とvertice4を求める
    vertice3 = shift_point(vertice1, vertice2);
    vertice4 = shift_point(vertice2, vertice3);
    printf(
        "%d %d %d %d\n", vertice3.x_elem, vertice3.y_elem,
        vertice4.x_elem, vertice4.y_elem
    );
    return 0;
}

// 既知の頂点から次の頂点を求める関数
point shift_point(point vertice1, point vertice2){
    point new_vertice;
    new_vertice.x_elem = vertice2.x_elem - (vertice2.y_elem - vertice1.y_elem);
    new_vertice.y_elem = vertice2.y_elem + (vertice2.x_elem - vertice1.x_elem);
    return new_vertice;
}

Measured memory_bytes: 1716
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#define ll long long 
using namespace std;
const int maxn=100000+10;
struct node{
	int w,ki;
    bool operator <(const node b)const{  
        return (this->w>b.w)||(this->w==b.w&&this->ki<b.ki);  
    }  	
};
priority_queue <node> q;
ll t[4];
int main(){
	int n,x,y,z;
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		node xx;
		scanf("%d",&x);
		xx.ki=1,xx.w=x;
		q.push(xx);
	}
	for(int i=1;i<=n;++i){
		node xx;
		scanf("%d",&x);
		xx.ki=2,xx.w=x;
		q.push(xx);
	}
	for(int i=1;i<=n;++i){
		node xx;
		scanf("%d",&x);
		xx.ki=3,xx.w=x;
		q.push(xx);
	}
	while(!q.empty()){
		node u=q.top();
		q.pop();
		if(u.ki!=1)t[u.ki]+=t[u.ki-1];
		else t[1]++;		
	}
	printf("%lld\n",t[3]);
	return 0;
}

Measured memory_bytes: 6512
N = int(input())
nums = [int(x) for x in input().split()]
cnt = 0
loop = True
while loop:
  if not all([n % 2 is 0 for n in nums]):
     
    break
    
  for i, n in enumerate(nums):
    nums[i] = n//2
  cnt += 1
print(cnt)

Measured memory_bytes: 3060
N,M = list(map(int,input().split()))
xarray = sorted(list(map(int,input().split())))
 
diff = []
if len(xarray) == 1:
    print(0)
elif N >= M:
    print(0)
else:
    for i in range(len(xarray)-1):
        diff.append(abs(xarray[i+1]-xarray[i]))
 
    if len(diff) == 0:
        print(0)
    else:
        diff2 = sorted(diff, reverse = True)
        
 
        if N == 1:
            
            print(sum(diff2))
        else:
            for j in range(N-1):
                diff2[j] = 0
            
            print(sum(diff2))

Measured memory_bytes: 13968
#include <iostream>
#include <cmath>
#include <algorithm>


using namespace std;

typedef long long LL;

const LL MAX = 100005;
const LL INF = 1000 * 1000 * 1000 + 9;

LL n, k, DP[MAX] = {}, stone[MAX] = {};

LL calc(LL idx)
{
  if(DP[idx] != INF)return DP[idx];
  else if(idx == n-1)return DP[idx] = 0;
  else if(idx > n-1)return INF;
  else
  {
    LL MIN = INF;
    for(LL i0 = 1; i0 <= k; i0++)
    {
      	if(idx + i0 > n-1)break;
    	MIN = min(MIN, calc(idx + i0) + abs(stone[idx + i0] - stone[idx]) );
    }
    return DP[idx] = MIN;
  }
}

int main(void)
{
  cin >> n >> k;
  for(LL i0 = 0; i0 < n; i0++)
  {
     cin >> stone[i0];
     DP[i0] = INF;
  }
  
  cout << calc(0) << endl;
  return 0;
}

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

const int N=310;
pair<int,int> p[N];
int vis[N],match[N];
int n;
int Find(int u)
{
    for(int i=n+1;i<=n+n;i++)
    {
        if(p[i].first>p[u].first&&p[i].second>p[u].second&&!vis[i])
        {
            vis[i]=1;
            if(!match[i]||Find(match[i]))
            {
                match[i]=u;
                return 1;
            }
        }
    }
    return 0;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n+n;i++)
        cin>>p[i].first>>p[i].second;
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        memset(vis,0,sizeof(vis));
        if(Find(i))
            ans++;
    }

    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e3 + 100;

int ans[maxn];

int dis[maxn][maxn];
int main(){
	int x, y;
	int n;
	cin >> n >> x >> y;
	for (int i = 1; i < n; i++){
		int p = 1;

		for (int j = i + 1; j <= n; j++){
			dis[i][j] = p;
			p++;
			if (j >= y&&i < x)
				dis[i][j] = min(dis[i][j], dis[i][x] + 1 + j - y);
			else if (i < x&&j<y&&j>x)
				dis[i][j] = min(dis[i][j], dis[i][x] + 1 + y - j);
			else if (i >= x)
				dis[i][j] = min(dis[i][j], dis[x][i] + 1 + abs(y - j));
			ans[dis[i][j]]++;
		}
	}
	for (int i = 1; i < n; i++)
		cout << ans[i] << endl;
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;

#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,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n, v[20], c[20];

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> v[i];
	REP(i, n) cin >> c[i];
	ll res = 0;
	REP(i, n) if (v[i] > c[i]) res += v[i] - c[i];
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 3596
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define LEN 5

long count;

void bogo(int *array, int n)
{
	int i;
	int rand1;
	int rand2;
	int check;
	int swap;
	
	srand((unsigned) time(NULL));
	while (1){
		check = 0;
		for (i = 0; i < n - 1; i++){
			if (array[i] < array[i + 1]){
				check = 1;
				break;
			}
		}
		if (check == 0){
			break;
		}
		else{
			for (i = 0; i < n; i++){
				rand1 = rand() % LEN - 0;
				rand2 = rand() % LEN - 0;
				swap = array[rand1];
				array[rand1] = array[rand2];
				array[rand2] = swap;
				count++;
			}
			/*for (i = 0; i < n; i++){
				printf("%d ", array[i]);
			}*/
			//printf("\n");
			if (count / LEN> 300000000){
				printf("Error!\n");
				break;
			}
		}
	
		/*for (i = 0; i < n; i++){
			printf("%d ", array[i]);
		}
		printf("\n");*/
	}
}
int main(void)
{
	int array[LEN];
	int i;
	
	srand((unsigned)time(NULL));
	
	for(i = 0; i < LEN; i++){
		//array[i] = rand() % 10 + 0;
		scanf("%d", &array[i]);
	}
	bogo(array, LEN);
	for (i = 0; i < LEN; i++){
		printf("%d", array[i]);
		if (i != LEN - 1){
			printf(" ");
		}
		else {
			printf("\n");
		}
	}
	//printf("%ld\n", count / LEN);
	
	return 0;
}

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

int n;
int num[100001];
int dp[100001];

int main(){
    memset(dp,63,sizeof dp);
    cin>>n;
    for(int qq=1;qq<=n;qq++)
        cin>>num[qq];
    dp[1]=0;
    dp[2]=abs(num[1]-num[2]);
    for(int qq=3;qq<=n;qq++){
        dp[qq]=min(abs(num[qq-2]-num[qq])+dp[qq-2],abs(num[qq-1]-num[qq])+dp[qq-1]);
    }
    cout<<dp[n];
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
struct Point
{
  double x,y;
  Point(){x=0;y=0;}
  Point(double d_x,double d_y){x=d_x,y=d_y;}
  double operator*(Point obj){return obj.x*x+obj.y*y;}
  double operator%(Point obj){return obj.y*x-obj.x*y;}
  Point operator*(double b){Point tmp;tmp.x=x*b;tmp.y=y*b;return tmp;}
  Point operator/(double b){Point tmp;tmp.x=x/b;tmp.y=y/b;return tmp;}
  Point operator+(Point obj){Point tmp;tmp.x=x+obj.x;tmp.y=y+obj.y;return tmp;}
  Point operator-(){Point tmp;tmp.x=-x;tmp.y=-y;return tmp;}
  Point operator-(Point obj){Point tmp;tmp.x=x-obj.x;tmp.y=y-obj.y;return tmp;}
  Point operator-=(Point obj){x-=obj.x;y-=obj.y;return *this;}
  Point operator+=(Point obj){x+=obj.x;y+=obj.y;return *this;}
  Point operator/=(double b){x=x/b;y=y/b;return *this;}
  Point operator*=(double b){x=x*b;y=y*b;return *this;}
  double size(){return hypot(x,y);}
  Point unit(){return Point(x/size(),y/size());}
  Point normal(){return Point(y,-x);}
  double atan(){return atan2(y,x);}
};

bool operator<(Point a,Point b){return a.x!=b.x?a.x<b.x:a.y<b.y;}
bool operator>(Point a,Point b){return b<a;}
bool operator<=(Point a,Point b){return !(b<a);}
bool operator>=(Point a,Point b){return !(a<b);}
bool operator==(Point a,Point b){return (a-b).size()<eps;}
bool operator!=(Point a,Point b){return !(a==b);}

bool equal(double a,double b){return abs(a-b)<eps;}
double cross(Point a,Point b){return a%b;}
double dot(Point a,Point b){return a*b;}

int ccw(Point a,Point b,Point c)
{
  b=b-a;
  c=c-a;
  if(b%c>0) return +1;
  else if(b%c<0)return -1;
  else if(b*c<0) return +2;
  else if(b.size()<c.size()) return -2;
  else return 0;
}

string S,T,s,t;
bool check()
{
  int i;
  int pos=0;
  if(s=="") return true;
  for(i=0;i<T.size();i++)
    {
      while(T[i]!=s[pos] && i< T.size()) i++;
      if(i>=T.size()) break;
      pos++;
      if(pos==(int)s.size())
	{
	  return true;
	}
    }
  return false;
}
int main(int argc,char const* argv[])
{
  bool flag=false;
  cin >> S >> T;
  s="";
  for(int i=0;i<S.size();i+=2) s+=S[i];
  flag|=check();
  s="";
  for(int i=1;i<S.size();i+=2) s+=S[i];
  flag |=check();
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 3228
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll MOD=1e9+7;
const ll N=2e5+5;
const ld pi=3.14159265359;
const ll INF=(1LL<<63);
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(a) (ll)a.size()

ll n,dp[N];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin>>n;
	dp[0]=1;
	REP1(i,n){
		REP(j,6)if(i>=100+j)dp[i]|=dp[i-100-j];
	}
	cout<<dp[n]<<"\n";
	return 0;
}




Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define int long long
using namespace std;
void solve()
{
    vector<string> v={"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
    string s;
    cin>>s;
    cout<<7-(find(v.begin(),v.end(),s)-v.begin());

}
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    int t=1;
    //cin>>t;
    while(t--) solve();

}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  ll n;
  cin >> n;
  vector<vl> f(n, vl(10)), p(n, vl(11));
  rep(i, n) rep(j, 10) cin >> f[i][j];
  rep(i, n) rep(j, 11) cin >> p[i][j];
  ll ans = -1e18;
  rep2(i, 1, 1 << 10) {
    vb open(10, false);
    rep(j, 10) if(i >> j & 1) open[j] = true;
    ll now = 0;
    rep(j, n) {
      ll cnt = 0;
      rep(k, 10) if(f[j][k] && open[k]) cnt++;
      now += p[j][cnt];
    }
    ans = max(ans, now);
  }
  cout << ans << endl;
}

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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  string s,t;  
  cin >> s;
  cin >> t;

  int count = 0;
  int length = s.length();
  for(int i=0;i<length;i++){
    if(s[i]!=t[i])count++;
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3868
#最初に置いておくもの
import sys
sys.setrecursionlimit(500000) 
input=sys.stdin.readline

N=int(input())
A = [list(map(int, input().split())) for _ in range(N)]

inf=float('inf')
dp=[[0]*3 for j in range(N+1)]

def chmax(a,b):
    return max(a,b)

for n in range(N):
    for i in range(3):
        for m in range(3):
                if (i == m):
                    continue
                dp[n+1][m]=chmax(dp[n+1][m], dp[n][i] + A[n][m])


re=max(dp[N][0],dp[N][1],dp[N][2])
print(re)

Measured memory_bytes: 47336
#define _USE_MATH_DEFINES
#define INF 100000000

#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>

using namespace std;

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


static const double EPS = 1e-8;

int tx[] = {-1,0,1,0};
int ty[] = {0,1,0,-1};

bool stage[101][101];

int main()
{
	int N;
	while(~scanf("%d",&N)){
		if(N==0) break;
		memset(stage,0,sizeof(stage));
		int W,H;
		
		scanf("%d %d",&W,&H);	
		for(int i=0;i<N;i++){
			int x,y;
			scanf("%d %d",&x,&y);
			stage[y-1][x-1] = true;
		}
		int S,T;
		int res = 0;
		scanf("%d %d",&S,&T);
		for(int y=0;y+T<=H;y++){
			for(int x=0;x+S<=W;x++){
				int tmp = 0;
				for(int ny=y;ny-y+1<=T;ny++){
					for(int nx=x;nx-x+1<=S;nx++){
						if(stage[ny][nx]) tmp++;
					}
				}

				res = max(res,tmp);
			}
		}

		printf("%d\n",res);
	}

}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n; i++)
#define all(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
const LL mod = 1000000007;

int main(){
    int n;
    int a, b;
    cin >> n;
    cin >> a >> b;

    vector<int> p(n);
    rep(i, n) cin >> p[i];
    vector<int> x(3, 0);
    rep(i, n){
        if(p[i] <= a){
            x[0]++;
        }else if(p[i] <= b){
            x[1]++;
        }else{
            x[2]++;
        }
    }
    cout << *min_element(all(x)) << endl;
    

}


Measured memory_bytes: 256
#include<stdio.h>

int strlen(char *a){for(int i=0;;i++)if(a[i]=='\0')return i;}

int strcmp(char *a,char *b){
	for(int i=0;i<7;i++)if(*(a+i)!=*(b+i))return 0;
	return 1;
}

char a[105][105];
int h,w;
int dR[105],dC[105],dRS=0,dCS=0;

int main(){
	scanf("%d%d",&h,&w);
	for(int i=0;i<h;i++)scanf("%s",a[i]);
	for(int i=0;i<h;i++){
		int f = 0;
		for(int j=0;j<w;j++)if(a[i][j]=='#'){
			f=1;
			break;
		}
		if(f==0){
			dR[dRS++]=i;
		}
	}
	for(int i=0;i<w;i++){
		int f = 0;
		for(int j=0;j<h;j++)if(a[j][i]=='#'){
			f=1;
			break;
		}
		if(f==0){
			dC[dCS++]=i;
		}
	}
	for(int i=0;i<h;i++){
		int af=0;
		for(int k=0;k<dRS;k++)if(dR[k]==i)af=1;
		if(af==1)continue;
		for(int j=0;j<w;j++){
			int f = 0;
			for(int k=0;k<dCS;k++)if(dC[k]==j)f=1;
			if(f==1)continue;;
			printf("%c",a[i][j]);
		}
		puts("");
	}

}


Measured memory_bytes: 128
#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 10000000000000000;


int alist[80][80];
int dp[80][80][80*320];

int main(){ 
    int h,w;
    cin >> h >> w;
    rep(i,h)rep(j,w) cin >> alist[i][j];
    rep(i,h)rep(j,w){int tmp; cin >> tmp; alist[i][j] = abs(alist[i][j] - tmp);}

    dp[0][0][80*160+alist[0][0]] = 1;
    dp[0][0][80*160-alist[0][0]] = 1;

    rep1(j,w-1)rep(itr,80*320) if(dp[0][j-1][itr] == 1){
        if (itr-alist[0][j] >= 0) dp[0][j][itr-alist[0][j]] = 1;
        if (itr+alist[0][j] < 80*320) dp[0][j][itr+alist[0][j]] = 1;
    }

    rep1(j,h-1)rep(itr,80*320) if(dp[j-1][0][itr] == 1){
        if (itr-alist[j][0] >= 0) dp[j][0][itr-alist[j][0]] = 1;
        if (itr+alist[j][0] < 80*320) dp[j][0][itr+alist[j][0]] = 1;
    }


    rep1(i,h-1)rep1(j,w-1)rep(itr,80*320) {
        if(dp[i][j-1][itr] == 1){
            if (itr-alist[i][j] >= 0) dp[i][j][itr-alist[i][j]] = 1;
            if (itr+alist[i][j] < 80*320) dp[i][j][itr+alist[i][j]] = 1;
        }
        if(dp[i-1][j][itr] == 1){
            if (itr-alist[i][j] >= 0) dp[i][j][itr-alist[i][j]] = 1;
            if (itr+alist[i][j] < 80*320) dp[i][j][itr+alist[i][j]] = 1;
        }
    }

    int ans = 12800;
    // rep(tmp,h)rep(j,w){for(int i = 80*20-10; i < 80*20+10; i++){cout << dp[tmp][j][i];}cout << endl;}
    rep(itr,80*320){
        if(dp[h-1][w-1][itr] == 1) ans = min(abs(itr-80*160),ans);
    }
    prints(ans);


    return 0;

}

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

int main() {
    int N;
    cin >> N;
    int sum = 0;
    bitset<4000001> bs(1);
    
    for(int i=0; i<N; ++i) {
        int a;
        cin >> a;
        sum += a;
        bs |= (bs << a);
    }

    for(int j=(sum + 1) / 2; j <= 4000000; ++j) {
        if(bs[j]) {
            cout << j << endl;
            return 0;
        }
    }
}

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

int main()
{
    int N;
    cin >> N;
    int hi;
    int prev = -1;
    bool isBad = false;
    for(int i=0;i<N;i++){
        cin >> hi;
        if(prev > hi) isBad = true;
        if(prev < hi) prev = hi - 1;
        else          prev = hi;
    }
    if(isBad) cout<<"No"<<endl;
    else      cout<<"Yes"<<endl;

    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <stack>
#include <queue>

#define FOR(i, b, e) for(ll i = (ll)(b); i < (ll)(e); ++i)
#define RFOR(i, b, e) for(ll i = (ll)(e-1); i >= (ll)(b); --i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, 0, n)
#define REPC(x,c) for(const auto& x:(c))
#define VS vector<string>
#define VL vector<long long>
#define VI vector<int>
#define VVI vector<vector<int>>
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort((x).rbegin(),(x).rend())
#define PAIR pair<ll,ll>
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using  ll = long long;
constexpr int MOD = 1000000007;
using namespace std;

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; }

VL prime_decomposition(ll n) {
	ll i = 2;
	VL table{};
	while (i * i <= n) {
		while (n % i == 0) {
			n /= i;
			table.emplace_back(i);
		}
		++i;
	}
	if (n > 1) {
		table.emplace_back(n);
		return table;
	}
}

int main() {
	ll n;
	cin >> n;
	VL v(n);
	REP(i, n) { cin >> v[i]; }


	ll min = 1e10;
	FOR(i, -100, 100 + 1) {
		ll cost = 0;
		REPC(x, v) {
			cost += pow(i - x, 2);
		}
		min = std::min(cost, min);
	}
	cout << min << endl;
}

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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  char a, b;
  cin >> a >> b;

  if (a == b) {
    cout << 'H' << endl;
  } else {
    cout << 'D' << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
        int i,n;
        int a[31] = {1,1,2};
        for(i=3 ; i <= 30 ; i++ ){
                a[i] = a[i-1] + a[i-2] + a[i-3];
        }
        for(;;){
        scanf("%d",&n);
        if(n==0)
                break;
        printf("%d\n",a[n]/10/365+1);
        }
        return 0;
}

Measured memory_bytes: 600
#include<iostream>
using namespace std;
int main(){
	int a,b;
	char op;
	for(int i=0;i<=2000;i++){
	cin>>a>>op>>b;
	if(op=='?'){
		break;
	}
	if(op=='+'){
		cout<<a+b<<endl;
	}
	if(op=='-'){
		cout<<a-b<<endl;
	}
	if(op=='*'){
		cout<<a*b<<endl;
	}
	if(op=='/'){
		cout<<a/b<<endl;
	}
	}
    return 0;
}


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

using namespace std;

const int inf = 1e9;

const int maxn = 1e5 + 100;

int dp[maxn][3];
int a[maxn], b[maxn], c[maxn];

signed main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    
    int n;
    cin >> n;
    
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }

    dp[0][0] = dp[0][1] = dp[0][2] = 0;
    
    for (int i = 1; i <= n; i++) {
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c[i];
    }
    
    cout << max(max(dp[n][0], dp[n][1]), dp[n][2]);
    
    return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
map<int, int> memo;
int f(int n) {
    if(memo[n] != 0) return memo[n];
    if(n == 1) return memo[n] = 1;
    else return memo[n] = 1 + 2 * f(n / 2);
}
signed main() {
    INCANT;
    int n, res = 0;
    cin>>n;
    cout<<f(n)<<endl;
}


Measured memory_bytes: 256
def main():
    n,t=map(int,input().split())
    F=[tuple(map(int,input().split())) for _ in range(n)]

    dp1=[[0]*t for _ in range(1+n)]
    dp2=[[0]*t for _ in range(1+n)]
    for i in range(n):
        a1=F[i][0]
        b1=F[i][1]
        a2=F[n-i-1][0]
        b2=F[n-i-1][1]
        for j in range(t):
            if j<a1:
                dp1[i+1][j]=dp1[i][j]
            else:
                dp1[i+1][j]=max(dp1[i][j],dp1[i][j-a1]+b1)
            
            if j<a2:
                dp2[i+1][j]=dp2[i][j]
            else:
                dp2[i+1][j]=max(dp2[i][j],dp2[i][j-a2]+b2)
    
    ans=0
    for i in range(n):
        b=F[i][1]
        for j in range(t):
            ans=max(dp1[i][j]+dp2[n-i-1][t-1-j]+b,ans)
    print(ans)          
  
if __name__=='__main__':
    main()

Measured memory_bytes: 179460