akhauriyash/Code-Regression huggingface dataset:
from collections import Counter

def main():
    n, k, q = map(int, input().split())
    a = [int(input()) for i in range(q)]
    a_c = Counter(a)
    for i in range(1, n+1):
        if q - a_c.get(i, 0) < k:
            print('Yes')
        else:
            print('No')

if __name__ == '__main__':
    main()

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

int main() {
	int n, k;
	double ans, tmp;
	cin >> n >> k;
	vector<int> p(n);
	vector<double> e(n);
	for(int i=0; i<n; i++){
		cin >> p[i];
	}
	for(int i=0; i<n; i++){
		e[i] = 0.5*(p[i]+1);
	}
	for(int i=0; i<n; i++){
		//cout << e[i] << endl;
	}

	ans = 0;
	tmp = 0;
	for(int i=0; i<k; i++){
		tmp += e[i];
	}
	ans = tmp;
	for(int i=1; i+k-1<n; i++){
		tmp -= e[i-1];
		tmp += e[i+k-1];
		ans = max(ans, tmp);
		//cout << ans << endl;
		//cout << "i-1: " << i-1 << ",  i+k-1: " <<  i+k-1 << endl;
	}
	printf("%.8f\n", ans);
	return 0;
}

Measured memory_bytes: 2560
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(s: &[char]) -> bool {
    let m = s.len();
    for i in 0..m {
        if s[i] != s[m - 1 - i] {
            return false;
        }
    }
    true
}

use std::iter::Iterator;
use std::cmp;

fn main() {
    input! {
        a : i32,
        b : i32,
        c : i32,
    }

    let mut ans = c - (a - b);
    if ans < 0 { ans = 0;}


    println!("{}", ans);

}


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

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ

		Scanner sc1 = new Scanner(System.in);

		int[] test = new int[5];
		test[0] = sc1.nextInt();
		test[1] = sc1.nextInt();
		test[2] = sc1.nextInt();
		test[3] = sc1.nextInt();
		test[4] = sc1.nextInt();
		int k = sc1.nextInt();

		Arrays.sort(test);
		//System.out.println(test[4]);
		//System.out.println(test[0]);

		if (test[4]-test[0] <= k) {
			System.out.println("Yay!");
		}
		else {
			System.out.println(":(");
		}

		sc1.close();

	}

}

Measured memory_bytes: 21844
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean deki=false;

		while(true) {
			deki=false;
			int tmp1=sc.nextInt();
			int tmp2=sc.nextInt();
			int g_syahen=tmp1*tmp1+tmp2*tmp2;

			if(tmp1*tmp2==0) {
				System.exit(0);
			}

			for(;; g_syahen++) {
				for(int i=1; i*i<=g_syahen; i++) {
					int ss=g_syahen-i*i;
					int bb=isHhs(ss);
					if(bb!=-1 && i<bb && ((tmp1+tmp2)!=i+bb || tmp1*tmp2!=i*bb)) {
						if(tmp1*tmp1+tmp2*tmp2<i*i+bb*bb) {
							System.out.println(i+" "+bb);
							deki=true;
							break;
						}
						else if(tmp1*tmp1+tmp2*tmp2==i*i+bb*bb) {
							if(tmp1<i) {
								System.out.println(i+" "+bb);
								deki=true;
								break;
							}
						}
					}
				}
				if(deki==true) {
					break;
				}
			}
		}
	}

	static int isHhs(int a) {
		boolean hhs=false;
		for(int i=1; i*i<=a; i++) {
			if(a==i*i) {
				hhs=true;
			}
			if(hhs==true) {
				return i;
			}
		}
		return -1;
	}
}


Measured memory_bytes: 26572
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    long long a[n], ans = 1LL<<60;
    for (int i = 0; i < n; i++) { cin >> a[i]; if (i > 0) a[i] += a[i-1]; }
    for (int i = 1; i < n-2; i++) {
        long long p, q, r, s;
        int j = lower_bound(a, a + i + 1, (a[i]+1)/2) - a;
        if (j == 0) { p = a[0]; q = a[i] - a[0]; }
        else if (j == i) { p = a[i-1]; q = a[i] - a[i-1]; }
        else if (abs(a[i] - 2 * a[j-1]) > abs(a[i] - 2 * a[j])) {
            p = a[j]; q = a[i] - a[j];
        } else { p = a[j-1]; q = a[i] - a[j-1]; }
        int k = lower_bound(a + i + 1, a + n, (a[n-1]+a[i]+1)/2) - a;
        if (k == i + 1) { r = a[i+1] - a[i]; s = a[n-1] - a[i+1]; }
        else if (k == n-1) { r = a[n-2] - a[i]; s = a[n-1] - a[n-2]; }
        else if (abs(a[n-1] + a[i] - 2* a[k-1]) > abs(a[n-1] + a[i] - 2 * a[k])) {
            r = a[k] - a[i]; s = a[n-1] - a[k];
        } else { r = a[k-1] - a[i]; s = a[n-1] - a[k-1]; }
        // cout << j << ' ' << i << ' ' << k << "; " << p << ' ' << q << ' ' << r << ' ' << s << endl;
        ans = min(ans, max({p, q, r, s}) - min({p, q, r, s}));
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
N = gets.to_i
P = gets.split.map &:to_i

RX = P.dup
(N-2).downto(0){|i|
	RX[i] = RX[i+1] if RX[i] < RX[i+1]
}
LX = P.dup
1.upto(N-1){|i|
	LX[i] = LX[i-1] if LX[i] < LX[i-1]
}

LU = lambda{|i, start|
	v = P[i]
	return -1 unless v < (LX[start]||0)
	return  start.downto(0).find{|j|
		v < P[j]
	}||-1
}
RU = lambda{|i, start|
	v = P[i]
	return N unless v < (RX[start]||0)
	return start.upto(N-1).find{|j|
		v < P[j]
	}||N
}

p N.times.map{|i|
	 l,  r = LU[i, i-1], RU[i, i+1]
	ll, rr = LU[i, l-1], RU[i, r+1]
	P[i] * ((i-l)*(rr-r) + (r-i)*(l-ll))
}.inject(&:+)


Measured memory_bytes: 14216
from collections import Counter
from scipy.misc import comb

N, M = map(int, input().split())
A = list(map(int, input().split()))
X = [0]
for a in A:
    X.append((X[-1] + a) % M)

X = Counter(X)
ans = 0
for num in X.values():
    ans += comb(num, 2, 1)

print(ans)


Measured memory_bytes: 26352
#include <iostream>
#include <vector>
#include <string>
#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;

int Cut(int n, int k, vector<string> & s) {
	int i, j, c = 0, ans = 0;
	vector<vector<int>> d(s.size(), vector<int>(s[0].size(), 0));
	vector<int> a(s.size());
	rep(i, s.size()) {
		a[i] = ans;
		if (n & (1 << i))
			ans++;
	}
	rep(j, s[0].size()) {
		rep(i, s.size()) {
			if (s[i][j] == '1') {
				if (c >= s[0].size())
					return INF;
				if (d[a[i]][c] == k) {
					c++;
					j--;
					break;
				}
				d[a[i]][c]++;
			}
		}
	}
	return ans + c;
}

int main(void) {
	int num, i, h, w, k, ans = INF;
	cin >> h >> w >> k;
	vector<string> s(h);
	rep(i, h)
		cin >> s[i];
	rep(i, 1 << (h - 1)) {
		chmin(ans, Cut(i, k, s));
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <cmath>

#define REP(i, n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define square(x) (x) * (x)
#define cube(x) (x) * (x) * (x)

const int INF = 1e9;

using namespace std;

int main() {
    int n, q;
    cin >> n >> q ;
    string name[n];
    int t[n];
    int current = 0;
    queue<int> rest;
    REP(i, n) { cin >> name[i] >> t[i]; rest.push(i); }
    while(!rest.empty()){
        if(t[rest.front()] <= q){
            current += t[rest.front()];
            cout << name[rest.front()] << " " << current << endl;
            rest.pop();
        } else {
            t[rest.front()] -= q;
            current += q;
            rest.push(rest.front());
            rest.pop();
        }
    }

    return 0;
}

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

#define readInt(num) scanf("%d", &num)
#define read(num1, num2) scanf("%d %d", &num1, &num2)
typedef long long int lli;

int n;
int a, avg, arr[51];
lli dp[51][2501][51];

lli solve(int pos, int sum, int cnt)
{
    if(pos == n) return 0;

    if(dp[pos][sum][cnt] != -1) return dp[pos][sum][cnt];

    dp[pos][sum][cnt] = 0;

    lli val1=0, val2=0;

    //cout << sum+arr[pos] << " " << cnt +1 << endl;

    if(sum+arr[pos] == ((cnt+1)*a))
    {
        val1 = 1+ solve(pos+1, sum+arr[pos], cnt+1);
    }
    else val1 = solve(pos+1, sum+arr[pos], cnt+1);

    val2 = solve(pos+1,sum,cnt);

    return dp[pos][sum][cnt] += (val1+val2);

}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    while(read(n,a) != EOF)
    {
        for(int i=0; i<n; i++) readInt(arr[i]);
        memset(dp, -1, sizeof dp);
        //a = a * n;
        printf("%lld\n", solve(0, 0, 0));
    }

    return 0;
}



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

struct city {
  int x;
  int y;
  int64_t p;
};

struct linescore {
  int lineid;
  int64_t s;
};

int64_t recursive_score(int K,
                        vector<vector<linescore>> &city_line_scores,
                        int current_line,
                        int selected_num,
                        vector<bool> &exist_lines) {
  if (selected_num == K) {
    int64_t s = 0;
    for (int i = 0; i < (int)city_line_scores.size(); i++) {
      for (auto line_score : city_line_scores[i]) {
        if (exist_lines[line_score.lineid]) {
          s += line_score.s;
          break;
        }
      }
    }
    return s;
  }

  int64_t min_score = 100000000000000LL;
  int add_line_num = (int)exist_lines.size() - 2;
  int rest = add_line_num - current_line;
  if (selected_num + rest < K) {
    return min_score;
  }
  if (current_line >= add_line_num) {
    return min_score;
  }
  exist_lines[current_line] = true;
  min_score = min(min_score, recursive_score(K, city_line_scores, current_line + 2, selected_num + 1, exist_lines));
  exist_lines[current_line] = false;
  exist_lines[current_line + 1] = true;
  min_score = min(min_score, recursive_score(K, city_line_scores, current_line + 2, selected_num + 1, exist_lines));
  exist_lines[current_line + 1] = false;
  min_score = min(min_score, recursive_score(K, city_line_scores, current_line + 2, selected_num, exist_lines));
  return min_score;
}

int main() {
  int N;
  cin >> N;
  vector<city> cities(N);
  for (int i = 0; i < N; i++) {
    int x, y, p;
    cin >> x;
    cin >> y;
    cin >> p;
    cities[i] = city{x, y, p};
  }

  vector<bool> exist_lines(N * 2 + 2);
  for (int j = 0; j < N; j++) {
    exist_lines[j * 2] = false;
    exist_lines[j * 2 + 1] = false;
  }
  exist_lines[N * 2] = true;
  exist_lines[N * 2 + 1] = true;

  vector<vector<linescore>> city_line_scores(N);
  for (int i = 0; i < N; i++) {
    int xi = cities[i].x;
    int yi = cities[i].y;
    int64_t pi = cities[i].p;

    vector<linescore> line_score(N * 2 + 2);

    for (int j = 0; j < N; j++) {
      int xj = cities[j].x;
      int yj = cities[j].y;

      line_score[j * 2] = linescore{j * 2, pi * abs(xi - xj)};
      line_score[j * 2 + 1] = linescore{j * 2 + 1, pi * abs(yi - yj)};
    }
    line_score[N * 2] = linescore{N * 2, pi * abs(xi)};
    line_score[N * 2 + 1] = linescore{N * 2 + 1, pi * abs(yi)};

    sort(line_score.begin(), line_score.end(), [](linescore a, linescore b) { return a.s < b.s; });
    city_line_scores[i] = line_score;
  }

  for (int K = 0; K < N; K++) {
    int64_t S = recursive_score(K, city_line_scores, 0, 0, exist_lines);
    cout << S << endl;
  }
  cout << 0 << endl;
}


Measured memory_bytes: 3620
N=int(input())
T= list(map(int, input().split()))
X=T
M=int(input())
Ml=[]
for i in range(0,M):
    P=list(map(int, input().split()))
    Ml.append(P)

for i in range(0,M):
    s=Ml[i][0]-1
    f=X[s]
    X[s]=Ml[i][1]
    print(sum(X))
    X[s]=f

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

int main(){
    int a, b, c;
    int t;
    
    cin >> a >> b >> c;
    
    //Step1
    if(a > b){
      t = a;
      a = b;
      b = t;
    }
    
    //Step2
    if(b > c){
      t = b;
      b = c;
      c = t;
    }
    
    //Step3
    if(a > b){
      t = a;
      a = b;
      b = t;
    }
    
    cout << a << " " << b << " " << c << endl;
    
    return 0;
}

Measured memory_bytes: 1164
/*     ####   ####  #               ####  #        ##   #    # #    # ###### #####
	  #      #    # #              #      #       #  #  ##  ## ##  ## #      #    #
	   ####  #    # #               ####  #      #    # # ## # # ## # #####  #    #
		   # #  # # #                   # #      ###### #    # #    # #      #####
	  #    # #   #  #              #    # #      #    # #    # #    # #      #   #
	   ####   ### # ###### #######  ####  ###### #    # #    # #    # ###### #    #
*/
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<pair<LL, LL> > VP;
 
 
#define For(in) for (LL i = 0; i < (n); i++)
#define FOR(in) for(LL i=1; i <= (n); i++)
#define pb push_back
#define sr(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define exit(); return 0;
#define no "NO"
#define yes "YES"
#define con continue;
 
 
LL concate(LL a, LL b)
{
	ostringstream os;
	os <<a <<b;
	istringstream is(os.str());
	LL c;
	is>> c;
	return c;
}
 
 
LL check(char c)
{
	return c=='a' || c=='e' || c=='i' || c=='o' || c=='u';
}
LL mod = 1e9+7;
 
 
int main()
{
	//LL q,t;
	//cin>>t;
	//while(t--)
	//{
	   LL a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,r=0,u=0,w=0,x=0,y=0,z=0;
		LL aa[1000];
		LL flag=0, flag1=0, co=0, co1=0, co2=0, co3=0, x1=0, x2=0, y1=0, y2=0, z1=0, z2=0;
		LL ma=0, mi=100000000;
		LL mid=0, temp=0, stop=0, start=0;
		double pi= 3.141592653589793;
		double d1=0.0, d2, d3, d4;
		VLL v,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10;
		VS vs, vs1, vs2, vs3, vs4;
		VP vp, vp1,vp2;
		char ch, ch1, ch2[1001];
		string str, str1, str2, str3, str4, str5;
		pair<LL, LL> pa;
		list<LL> li, li1;
		map<LL, LL> mp, mp1;
		set<LL> st;
		map<LL ,LL> :: iterator imll;
		VLL :: iterator ivll;
		set<LL> :: iterator isll;
		VP :: iterator ivp;
 
		
		cin>>str>>str1;
		if(str.size()>str1.size())cout<<"GREATER"<<endl;
		else if(str.size()<str1.size())cout<<"LESS"<<endl;
		else if(str==str1)cout<<"EQUAL"<<endl;
		else 
		{
			for(i=0; i<str.size(); i++)
			{
				if(str[i]>str1[i])
				{
					flag=1;
					break;
				}
				if(str[i]<str1[i])
				{
					flag=2;
					break;
				}
			}
			if(flag==1)cout<<"GREATER"<<endl;
			if(flag==2)cout<<"LESS"<<endl;
		}

		
		
		
		
	exit()
 
 
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
  int d, sum;
  while(!feof(stdin)) {
    scanf("%d", &d);
    if(feof(stdin)) break;
    sum=0;
    for(int i=d;i!=600;i+=d) {
      //printf("%d\n", i*i*i*d);
      sum+=d*i*i;
    }
    printf("%d\n", sum);
  }
}

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

using namespace std;

typedef long long ll;

const int INF = 1e9;
const ll LLINF = 1e18;
const ll MOD = (ll)1e9 + 7;

int main()
{
  int N; scanf("%d", &N);
  vector<string> S(N);
  for (int i = 0; i < N; ++i) {
    cin >> S[i];
  }
  int M; scanf("%d", &M);
  vector<string> T(M);
  for (int i = 0; i < M; ++i) {
    cin >> T[i];
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    int sum = count(S.begin(), S.end(), S[i]) - count(T.begin(), T.end(), S[i]);
    ans = max(ans, sum);
  }
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 256
import collections
N = int(input())

A = list(map(int, input().split()))


def serch(li, x):
    l = 0
    r = len(li)
    mid = 0
    while True:
        mid = (l + r) // 2
        if li[mid] == x:
            return True

        if l >= r:
            break

        if li[mid] < x:
            l = mid + 1
        else:
            r = mid

    return False


ma = []
for i, a in enumerate(A):
    ma.append(i + a)

cnt = collections.Counter(ma)

ans = 0
for i, a in enumerate(A):
    # print(f"{i}  ===  {cnt[i + a]}")
    ans += cnt[i - a]

print(ans)


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

vector<ll> divisor(ll n) {
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i) {
      if(n % i == 0) {
          ll a = (i + 1) / 2;
          for (a; a < 120; ++a) {
            ll b = a - i;
            // cout << a << " "<< b << endl;
            if( a*a*a*a*a - b*b*b*b*b == n){
              res.push_back(a);
              res.push_back(b);
              break;
            }
          }
      } 
    }
    return res;
}

int main() {
  ll x;
  cin >> x;
  vector<ll> dv;
  dv = divisor(x);

  for(auto d: dv) cout << d << " ";
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mod 1000000007
void solve()
{
	vector<int> v(101,0);
	for(ll i=2;i<101;i*=2)
	{
		v[i]=1;
	}
	ll n;
	cin>>n;
	for(ll i=n;i>=2;i--)
	{
		if(v[i]==1)
		{
			cout<<i;
			return;
		}
	}
	cout<<1;
	return;
}
int main()
{
	fast;
	int q;
	q=1;
	// cin>>q;
	while(q--)
	{
		solve();
	}
	return 0;
}

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

using namespace std;


struct data{
  string name;
  int P,A,B,C,D,E,F,S,M;
  data(){}

  void input(istream& is){
    is>>name>>P>>A>>B>>C>>D>>E>>F>>S>>M;
  }
  double getValue() const {
    double T = A+B+C+D+E;
    double res = F;

    for(int i = 1; i < M; i++){
      res += F;
      T += D+E;
    }
    return (S*res-P)/T;
  }

  bool operator < (const data& d) const{
    double T1 = getValue();
    double T2 = d.getValue();
    if(T1 ==  T2) return name < d.name;
    return getValue() > d.getValue();
  }  
};

int n;
vector<data> V;

void init(){
  V.clear(); 
}

void input(){
  V.resize(n); 

  for(int i = 0; i < n; i++)
    V[i].input(cin);
}

void solve(){
  sort(V.begin(),V.end());

  for(int i = 0; i < (int)V.size(); i++) cout << V[i].name << endl;
  cout << "#" << endl;
}

int main(){

  while(cin >> n && n){
    init();
    input();
    solve();
  }
  return 0;
}

Measured memory_bytes: 1228
#include<stdio.h>

int main()
{
char a[2];
  scanf("%c",a);

  //printf("%c",a[0]);
  
  if (a[0] >= 'A' && a[0] <='Z')
  {
  printf("A");
    return 0;
  }
  printf("a");
  
  return 0;
  
}


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

int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(abs(a-c) <= d) cout << "Yes ";
    else if(abs(a-b) <= d && abs(b-c) <= d) cout << "Yes ";
    else cout << "No ";
    return 0;
}


Measured memory_bytes: 256
from collections import OrderedDict

f_row_nums = list(input().split())
s_row_nums = list(input().split())
t_row_nums = list(input().split())
N = int(input())
chosen_nums = [input() for _ in range(N)]

f_dict = OrderedDict()
for key in f_row_nums:
    f_dict[key] = False
s_dict = OrderedDict()
for key in s_row_nums:
    s_dict[key] = False
t_dict = OrderedDict()
for key in t_row_nums:
    t_dict[key] = False

for num in chosen_nums:
    if num in f_dict:
        f_dict[num] = True
    if num in s_dict:
        s_dict[num] = True
    if num in t_dict:
        t_dict[num] = True

f_rows = list(f_dict.values())
s_rows = list(s_dict.values())
t_rows = list(t_dict.values())

f_cols = [f_rows[0], s_rows[0], t_rows[0]]
s_cols = [f_rows[1], s_rows[1], t_rows[1]]
t_cols = [f_rows[2], s_rows[2], t_rows[2]]

out = "No"

if all(f_rows) or all(s_rows) or all(t_rows) or all(f_cols) or all(s_cols) or all(t_cols):
    out = "Yes"
elif f_rows[0] and s_rows[1] and t_rows[2]:
    out = "Yes"
elif f_rows[2] and s_rows[1] and t_rows[0]:
    out = "Yes"

print(out)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  vector<int> s(5);
  for(auto& tmp:s){
  	cin >> tmp;
  }
  
  int t=0;
  int m=10;
  for (int i=0;i<5;i++) {
    if (s[i]%10 == 0) {
      t += s[i];
    } else if (s[i]%10 != 0){
      t += (s[i]/10+1)*10;
      m = min(s[i]%10,m);
    }
  }
  if (m == 10)  {
    cout << t << endl;
  }else {
  cout << t - (10-m)<< endl;
  }
  
  return 0;
}

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

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N;
	cin >> N;
	if(!(N&1)) printf("0.5000000000\n");
	else
		printf("%.10f\n",(N+1) / 2.0 / N);
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
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; }

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int N, K, Q;
    cin >> N >> K >> Q;

    vector<int> val(N, 0);
    for(int i = 0; i < Q; i++){
        int a; cin >> a;
        a--;
        val[a]++;
    }

    for(int i = 0; i < N; i++){
        if(Q-val[i] >= K) cout <<"No" << endl;
        else cout << "Yes" << endl;
    }


    return 0;
}


Measured memory_bytes: 1024
#![allow(non_snake_case)]
fn main() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n:usize = sc.read();
    let m:usize = sc.read();

    let mut v: Vec<Vec<usize>> = vec![ vec![];n];
    for _ in 0..m {
        let a:usize = sc.read();
        let b:usize = sc.read();
        v[a-1].push(b-1);
    }
    
    let mut path: Vec<f64> = vec![0 as f64; n];
    for i in (0..(n-1)).rev(){
        let l:f64 = v[i].len() as f64;
        let mut mass :f64 = 0 as f64;
        for j in 0..(v[i].len()){
            mass += path[v[i][j]];
        }
        path[i] = mass/l+1f64;
    }
    let mut ans: f64 = path[0];

    for k in 0..(n-1) {
        if v[k].len() == 1{
            continue;
        }
        let mut max: f64 = path[v[k][0]];
        for j in 0..(v[k].len()){
            if max < path[v[k][j]]{
                max = path[v[k][j]];
            }
        }

        let mut road: Vec<f64> = vec![0 as f64; n];
        for i in (0..(n-1)).rev(){
            let mut mass :f64 = 0 as f64;
            for j in 0..(v[i].len()){
                mass += road[v[i][j]];
            }
            if i == k{
                mass -= max;
                mass /= (v[i].len()-1) as f64
            }else{
                mass /= v[i].len() as f64
            }
            road[i] = mass + 1f64;
        }
        if ans > road[0]{
            ans = road[0];
        }
    }
    println!("{}", ans);

}

pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n')
            .take_while(|&b| b != b' ' && b != b'\n')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}




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

int main(){
  int n; cin >> n;
  int d[n]; for(int i=0;i<n;i++){cin>>d[i];}
  
  int sum=0;
  for(int i=0; i<n-1; i++){
    for(int j=i+1; j<n; j++){
      sum = sum+d[i]*d[j];
    }
  }
  
  cout << sum;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  string s;
  cin >> s;
  int n = s.size();

  int cnt = 0;
  rep(i, n) {
    if (s[i] == '0')
      cnt++;
    else
      cnt--;
  }
  cout << n- abs(cnt) << endl;
}


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

void Main()
{
    int n;
    cin >> n;
    map<string, int> got;
    for (int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        got[s]++;
    }
   
    cout << got.size() << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 19152
#include<iostream>
using namespace std;
int main(){
  char c;
  cin>>c;
  if(c=='A'){
    cout<<'T'<<endl;
  }else if(c=='T'){
    cout<<'A'<<endl;
  }else if(c=='G'){
    cout<<'C'<<endl;
  }else{
    cout<<'G'<<endl;
  }
  return 0;
}
    

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

#define pb push_back
#define F first
#define S second
#define y1 dasdasfasfas
#define x1 wqdadfasfasfas
#define All(c) c.begin(), c.end()
#define SZ(A) (int((A).size()))
#define umap unordered_map
#define __ fflush(stdout)
#define FILENAME ""

typedef long long ll;
typedef long double ld;    

using namespace std;

void FREOPEN() {
	#ifdef LOCAL
		freopen(".in", "r", stdin);
		freopen("1.out", "w", stdout);
	#else
		//freopen(FILENAME".in", "r", stdin);
		//freopen(FILENAME".out", "w", stdout);
	#endif
}

inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; }             

const int N = 200500, inf = 1e9 * 2;

const ll MOD = 1e9 + 7ll, INF = 1e18;

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

int b[N];

int main() {
	FREOPEN();
	int n, m, c;
	cin >> n >> m >> c;
	int ans = 0;
	for (int i = 1; i <= m; i++) cin >> b[i];
	for (int i = 1; i <= n; i++) {
		int sum = c;
		for (int j = 1; j <= m; j++) {
			int a;
			cin >> a;
			sum += a * b[j];
		}
		if (sum > 0) ans++;
	}
	cout << ans;
	return 0;
}


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

const int N = 200000+7;
int fr[N];

int main()
{
    int n, k;
    cin>>n>>k;
    for (int i=0; i<n; i++)
    {
        int x;
        cin>>x;
        fr[x]++;
    }

    sort (fr, fr+N, greater<int>());
    int ans = 0;
    for (int i=k; i<N; i++)
        ans+=fr[i];
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# ---------標準入力時--------------
h,w=map(int,readline().split())
ch, cw=map(int,readline().split())
dh, dw=map(int,readline().split())
m=list(map(lambda x: list(x.decode()), readlines()))
# ---------標準入力時--------------

ad = [(-1,0), (0,-1), (1,0), (0,1)]
warp = [(-2, -2),(-2, -1),(-2, 0),(-2, 1),(-2, 2),
 (-1, -2),(-1, -1),(-1, 1),(-1, 2),
 (0, -2),(0, 2),
 (1, -2),(1, -1),(1, 1),(1, 2),
 (2, -2),(2, -1),(2, 0),(2, 1),(2, 2)]

def bfs6():
    '''
    bfs5から少し変更
    あるマス(i,j)から上(i-1,j)下(i+1,j) もしくは 左(i,j-1)右(i,j+1)に歩いて行ける時、
    (i,j)からwarpで行ける範囲は、その上下もしくは左右でカバーされるので、(i,jは考えなくていい)
    これをwarpを考えるときに処理する
    '''
    que1=[]
    que2=[] # queueというよりはメモリ
    m[ch][cw]=str(0)
    que1.append((ch,cw))

    while que1!=[]:
        l1=len(que1)
        r1=0 # que1における使用済みindex

        # que1の要素(座標)から歩いていけるマス
        while r1<l1:
            i, j=que1[r1]
            r1+=1
            for si, sj in ad:
                if m[i+si][j+sj]=='.': 
                    m[i+si][j+sj]=m[i][j]
                    que1.append((i+si, j+sj))
                    l1+=1

        # 歩いていけないマス
        for i,j in que1:
            if (m[i][j]==m[i-1][j] and m[i][j]==m[i+1][j]) or (m[i][j]==m[i][j-1] and m[i][j]==m[i][j+1]):
                continue
            for si, sj in warp:
                if m[i+si][j+sj]=='.':
                    m[i+si][j+sj]=str(int(m[i][j])+1)
                    que2.append((i+si, j+sj))

        que1=que2
        que2=[]
###---------------------------------------

for i in range(h):
    m[i] = ['#']*2 + m[i] + ['#']*2
    
m = [['#']*(w+4)]*2 + m + [['#']*(w+4)]*2
ch+=1; cw+=1; dh+=1; dw+=1

bfs6()

if m[dh][dw] == '.':
    print(-1)
else:
    print(m[dh][dw])

Measured memory_bytes: 29044
// ABC154 E - Almost Everywhere Zero
// 問題URL
// https://atcoder.jp/contests/abc154/tasks/abc154_e

#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>

using namespace std;

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

  int64_t ans = N / (A + B) * A + min(A, N % (A + B));

  cout << ans << endl;

  return 0;
}


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


int main(){
    int k;
    cin >> k;
    vector<int> a(k+1);
    a[1]=7%k;
    if(a[1]==0) {
        cout << 1 << endl;
        return 0;
    }
    for(int i=2; i<=k; i++){
        a[i] = (a[i-1]*10+7)%k;
        if(a[i]==0){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}

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

public class Main
{
	public static void main(String[] args)throws Exception
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n  = Integer.parseInt(br.readLine());
		String[] g  = br.readLine().split(" ");
		int [] ar = new int[n];
		for( int i = 0 ; i< n ; i++){
			ar[i] = Integer.parseInt(g[i]);
		}
		int m  = Integer.parseInt(br.readLine());
		int ans = 0;
		g  = br.readLine().split(" ");
		for(int i = 0 ; i <m; i++)
		{
			if(binarySearch(ar,Integer.parseInt(g[i])) != -1) ans++ ;	
		}
		System.out.println(ans);
	}
	public static int binarySearch(int[] c, int key)
	{
		int len = c.length;
		int left = 0 , right = len;
		int mid = (right + left) / 2 ;
		while(left < right){
			if(c[mid] == key) return mid;
			else if(c[mid] < key) left = mid+1;
			else { right = mid;  }
			mid = (right + left) / 2 ;
		}
		return -1;
	}
	
}

Measured memory_bytes: 47260
#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() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  sort(a.begin(), a.end(), greater<int>());
  int l1 = 0, l2 = 0;
  for (int i = 1; i < n; ++i) {
    if (a[i] == a[i-1]) {
      if (l1 == 0) {
        l1 = a[i];
        ++i;
      } else if (l2 == 0) {
        l2 = a[i];
      }
    }
  }
  ll ans = (ll)l1 * l2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin >> s;
    vector<int> a; 
    vector<int> z;
    //A,Zの位置をvector配列a,zに記録
    for(int i = 0; i < s.length(); i++){
        if(s[i] == 'A'){
            a.push_back(i);
        }else if(s[i] == 'Z'){
            z.push_back(i);
        }
    }
    //x (Zの位置)-(Aの位置) の値が最大になる時を探す
    //o 単に 最後のZの位置-最後のAの位置 とすればOK！
    /*
    int max = 0;
    for(int i = 0; i < a.size(); i ++){
        for(int j = 0; j < z.size(); j++){
            if(z[j] - a[i] > max){
                max = z[j] - a[i];
            }
        }
    }
    */

    cout << z[z.size() - 1] - a[0] + 1 << endl;
    return 0;
}

Measured memory_bytes: 1364
n, x, m = map(int, input().split())
num = {x}
num2 = [x]
while True:
    temp = num2[-1] ** 2 % m
    if temp in num:
        break
    else:
        num.add(temp)
        num2.append(temp)
temp2 = num2.index(temp)
num3 = num2[:temp2]
num4 = num2[temp2:]
ans = sum(num3) + sum(num4) * ((n - len(num3)) // len(num4)) + sum(num4[:(n - len(num3)) % len(num4)])
print(ans)

Measured memory_bytes: 13504
import sys,binascii
s = sys.stdin.read()
a = ""
for i in range(11):
    a += str(binascii.crc32((s+"  "*i).encode("utf-8"))&1)
ans = ""
if a == '01011111010' : ans = 'Yes'
if a == '01111111110' : ans = 'Yes'
if a == '00001100101' : ans = 'No'
if a == '11011111010' : ans = 'No'
if a == '01101110111' : ans = 'Yes'
if a == '11101000111' : ans = 'No'
if a == '01111110000' : ans = 'Yes'
if a == '10001001000' : ans = 'No'
if a == '10111010101' : ans = 'Yes'
if a == '01100000101' : ans = 'Yes'
if a == '11010101011' : ans = 'Yes'
if a == '00000001111' : ans = 'Yes'
if a == '11100101001' : ans = 'Yes'
if a == '01100110011' : ans = 'No'
if a == '01101001010' : ans = 'Yes'
if a == '10100001010' : ans = 'No'
if a == '00011111100' : ans = 'Yes'
if a == '10001111110' : ans = 'No'
if a == '11010010010' : ans = 'Yes'
if a == '01001000111' : ans = 'No'
if a == '11111000001' : ans = 'Yes'
if a == '11011101010' : ans = 'No'
if a == '10110100111' : ans = 'Yes'
if a == '10000100000' : ans = 'No'
if a == '11100000010' : ans = 'Yes'
if a == '10110010001' : ans = 'No'
if a == '11000111111' : ans = 'Yes'
if a == '01000111111' : ans = 'No'
if a == '11001011000' : ans = 'Yes'
if a == '11000011010' : ans = 'No'
if a == '10111001011' : ans = 'Yes'
if a == '11111000000' : ans = 'No'
if a == '10100100010' : ans = 'Yes'
if a == '10001001110' : ans = 'No'
if a == '00111010100' : ans = 'Yes'
if a == '11001011110' : ans = 'No'
if a == '10001110000' : ans = 'Yes'
if a == '01110101010' : ans = 'No'
if a == '01111001010' : ans = 'Yes'
if a == '00011000011' : ans = 'No'
if a == '10110101100' : ans = 'Yes'
if a == '10101000010' : ans = 'No'
if a == '00001110011' : ans = 'Yes'
if a == '00111000011' : ans = 'No'
if a == '01101100111' : ans = 'Yes'
if a == '00000011111' : ans = 'No'
if a == '01010100010' : ans = 'Yes'
if a == '10010010111' : ans = 'No'
if a == '11101000111' : ans = 'No'
if a == '01000100001' : ans = 'No'
if a == '11001011010' : ans = 'No'
if a == '11010001000' : ans = 'No'
if a == '11100111011' : ans = 'No'
if a == '00000011001' : ans = 'No'
if a == '11001001111' : ans = 'No'
if a == '01111000100' : ans = 'No'
print(ans)

Measured memory_bytes: 3192
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int>
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0);
const int32_t mod = 1e9+7;
const int32_t maxn=2e5+5;
int inf=1e18;

void solve(){
    int n,x,k;
    cin>>n>>x>>k;
    cout<<k*((n+x-1)/x);
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;  
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
 
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ll long long
#define ull unsigned long long
#define F first
#define S second
 
const int MOD = 1e9 + 7; 
const int N = 1e5; 
const int INF = 1e9 + 5; 

int a[111]; 
int main(void) 
{

	#ifndef ONLINE_JUDGE
//	freopen("input.txt", "r", stdin);
	#endif

	int n, m; 
	scanf("%d %d", &n, &m); 
	int sum=0; 
	for (int i=1; i<=n; i++) 
	{
		scanf("%d", &a[i]); 
		sum += a[i]; 
	}

	int cnt =0; 
	for (int i=1; i<=n; i++) 
	{
		if (a[i] >=(double) sum/(4*m))
			cnt++; 
	}
	cout << ((cnt>=m) ? "Yes\n" : "No\n"); 

	return false; 
}


Measured memory_bytes: 256
a,v=gets.split.map(&:to_i)
b,w=gets.split.map(&:to_i)
t=gets.to_i


x=b-a
x=x.abs

at=v*t
bt=w*t
result=(at-bt)


if result >=x
    puts "YES"
else
    puts "NO"
end


Measured memory_bytes: 14396
import fractions
A,B = map(int,input().split())
C = fractions.gcd(A,B)

def factorize(n):
    b = 2
    fct = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b = b + 1
    if n > 1:
        fct.append(n)
    return fct
D = factorize(C)

X = list(set(D))
print(len(X)+1)

Measured memory_bytes: 5048
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
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++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
#define vec vector
typedef long long ll;
typedef pair<ll,ll> P;
//const ll big=998244353;
const ll big=1000000007LL;
const ll INF=1e18;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    string s,t;cin >> s >> t;
    int cnt=100000;
    rep(i,s.size()-(int)t.size()+1){//i文字目からスタート
        int now=0;
        rep(j,t.size()){
            if(s[i+j]!=t[j])now++;
        }
        cnt=min(cnt,now);
    }
    cout << cnt << endl;
}

Measured memory_bytes: 3648
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
	int e;
	while (scanf("%d", &e), e)
	{
		int res = e;
		for (int z = 0; z*z*z <= e; ++z)
		{
			int y = sqrt(e - z*z*z + 0.5);
			min_swap(res, (e - (y*y + z*z*z) + y + z));
		}
		printf("%d\n", res);
	}
}

Measured memory_bytes: 0
// template ver2.02

// include
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

using namespace std;

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

// typedef
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

// util
#define MP make_pair
#define EACH(i, c) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define CLR(a) memset((a), 0 , sizeof(a))
template<class T, class C> inline bool in(T e, C c) {return c.find(e) != c.end();}
template<class T> inline bool in(T x, T a, T b) {return a <= x && x < b;}

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RFOR(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define RREP(i, n) RFOR(i, 0, n)

// IO
#define PRA(a, n) cout << a[0]; FOR(itr, 1, n) {cout << " " << a[itr];} cout << endl;
#define PRF(x, w) cout << setprecision((w)); cout << setiosflags(ios::fixed); cout << (x) << endl;

// constant
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int INF = (int)1e9;
const int DI[] = {0, 1, 0, -1};
const int DJ[] = {1, 0, -1, 0};

// debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DUMPA(a, n) cerr << #a << " = {" << a[0]; FOR(itr, 1, n) { cout << ", " << a[itr]; } cerr << "}" << endl;
#define DUMPAA(a, n, m) REP(itr, n) {REP(jtr, m) {cout << a[itr][jtr] << " ";} cout << endl;}

// template end

const int R_MAX = 10000;

int n, k, m, r;

int prob[2 * R_MAX + 1];

void add_inv(int x) 
{
    int d = 1;
    REP(i, 2 * r + 1) {
        if (d >= x) {
            prob[i] += d / x;
            d %= x;
        }
        d *= 10;
    }
}

void init()
{
}

void solve()
{
    CLR(prob);
    add_inv(n);
    if (m == 1) FOR(i, 1, n) add_inv(n * i);
    RREP(i, 2 * r + 1) {
        prob[i - 1] += prob[i] / 10;
        prob[i] %= 10;
    }
    cout << prob[0] << '.';
    FOR(i, 1, r + 1) cout << prob[i];
    cout << endl;
}

int main()
{
    init();
    while (cin >> n >> k >> m >> r, n) solve();
    return 0;
}


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

int main(){

    long long N, K;
    cin >> N >> K;

    long long odd = 0, even = 0;
    for(int a = 1; a <= N; a++){
        if(a % K == 0) odd++;
        else if(K % 2 == 0 && a % K == K / 2) even++;
    }
    
    cout << odd * odd * odd + even * even * even << endl;

    return 0;
}

Measured memory_bytes: 256
s = input().split()
a = int(s[0])-1
t=0
def hantei(x):
    i=2
    while i*i < a:
        if x % i == 0:
            return 0
        i += 1
    return 1
while t<1:
    a += 1
    t=hantei(a)
print(a)

Measured memory_bytes: 2940
n=int(input())
A=[int(i) for i in input().split()]

Ans=[0]*n
Ans[0]=1
Stack=[[A[0],1]]
for i in range(1,n):
  a=A[i]
  b,ct_b=Stack.pop()
  ct=1
  while b>a and Stack:
    ct+=ct_b
    b,ct_b=Stack.pop()
  if b<a:
    Stack.append([b,ct_b])
    Stack.append([a,ct])
  else:
    Stack.append([a,ct+ct_b])
    ct+=ct_b
  Ans[i]=ct
RA=A[::-1]
Ans_R=[0]*n
Ans_R[0]=1
Stack=[[RA[0],1]]
for i in range(1,n):
  a=RA[i]
  b,ct_b=Stack.pop()
  ct=1
  while b>a and Stack:
    ct+=ct_b
    b,ct_b=Stack.pop()
  if b<a:
    Stack.append([b,ct_b])
    Stack.append([a,ct])
  else:
    Stack.append([a,ct+ct_b])
    ct+=ct_b
  Ans_R[i]=ct  
Ans_R=Ans_R[::-1]
ans=0
for i in range(n):
  ans+=(A[i]*Ans[i]*Ans_R[i])
print(ans)

Measured memory_bytes: 43920
#include <stdio.h>

int num[10];

int func(n , r , l){
	if(n == 10) return 1;
	if(num[n] > r){
		if(func(n+1 , num[n] , l)) return 1;
	}
	if(num[n] > l){
		if(func(n+1 , r , num[n])) return 1;
	}
	return 0;
}

int main(void){
	int i , j , n;
	scanf("%d" , &n);
	for(i=0;i<n;i++){
		for(j=0;j<10;j++){
			scanf("%d" , &num[j]);
		}
		if(func(0 , 0 , 0)) printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.IO;
using System.Text;
using static Scanner;

class Program
{
    static void Main(string[] args) {
        var writer = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(writer);
        Solve();
        Console.Out.Flush();
    }
    static void Solve() {
        const int mod = 1000000007;
        var N = ScanInt();
        var A = new int[N];
        long sum = 0;
        for (int i = 0; i < N; i++) {
            A[i] = ScanInt();
            sum += A[i];
        }
        long answer = 0;
        for (int i = 0; i < N - 1; i++) {
            sum -= A[i];
            answer = (answer + sum % mod * A[i]) % mod;
        }
        Console.WriteLine(answer);
    }
}

public static class Scanner
{
    static readonly Stream stream = Console.OpenStandardInput();
    static readonly byte[] buffer = new byte[1024];
    static int length, p;
    static bool isEof;
    private static byte ConsoleIn() {
        if (isEof) return 0;
        if (p < length) return buffer[p++];
        p = 0;
        if ((length = stream.Read(buffer, 0, 1024)) > 0) return buffer[p++];
        isEof = true;
        return 0;
    }
    public static char GetChar() {
        var by = ConsoleIn();
        while ((by < '!' || '~' < by) && !isEof) by = ConsoleIn();
        return (char) by;
    }
    public static int ScanInt() {
        var temp = 0;
        for (var ch = GetChar(); '0' <= ch && ch <= '9'; ch = (char) ConsoleIn()) {
            temp = temp * 10 + ch - '0';
        }
        return temp;
    }
}

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

using ll = long long;
using ld = long double;

void solve() {
  ll n;
  cin >> n;
  ll ans = 0;
  for(ll i = 1; i < n; i++) {
    ans += ((n - 1) / i);
  }
  cout << ans << '\n';
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);

  int TC = 1;
  for(int i = 1; i <= TC; i++) {
    solve();
  }
  
  return 0;
}

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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	string N;
	cin>>N;
	if(N[N.size()-1]=='3')
	    cout<<"bon"<<"\n";
	else if(N[N.size()-1]=='0' or N[N.size()-1]=='1' or N[N.size()-1]=='6' or N[N.size()-1]=='8') 
	    cout<<"pon"<<"\n";
	else
	    cout<<"hon"<<"\n";
	return 0;
}

Measured memory_bytes: 3652
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
  string s,result;
  int count=0;
  
  cin  >> s;
  
  if(s[0]==s[1])count++;
  if(s[0]==s[2])count++;
  if(s[0]==s[3])count++;
  if(s[1]==s[2])count++;
  if(s[1]==s[3])count++;
  if(s[2]==s[3])count++;
  
  if(count==2)cout<<"Yes";
  else  cout<<"No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

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

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	cout << (1000 - (n % 1000)) % 1000 << '\n';
}


Measured memory_bytes: 3624