akhauriyash/Code-Regression huggingface dataset:
package main

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

func main() {
	log.SetFlags(log.Lshortfile)
	a := nextInt()
	b := nextInt()
	c := nextInt()
	if a+b == c || a+c == b || a == b+c {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func intPow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func intMax(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func intMin(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func intSum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func intAbs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type pair struct {
	a, b int
}

type pairs []pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	return p[i].b < p[j].b
}

var nextReader func() string

func init() {
	nextReader = newScanner()
}

func newScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}
func nextString() string {
	return nextReader()
}
func nextInt64() int64 {
	v, _ := strconv.ParseInt(nextReader(), 10, 64)
	return v
}
func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}
func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}
func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(nextReader(), 64)
	return f
}


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

#define ll          long long
#define mp	    make_pair
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
#define N	    1000001
ll A[N], dp[N];
void solve(){	
	ll n, k;
	cin >> n >> k;
	ll A[n+1];
	rep(i, 1, n+1)
		cin >> A[i];
	vi v[n+1];
	dp[1] = 0;
	rep(i, 2, n+1){
		int j = 1, cnt=0;
		while(cnt<k && i-j >=1){
			v[i].pb(abs(A[i] - A[i-j]) + dp[i-j]);
			j++;
			cnt++;
		}
		dp[i] = *min_element(all(v[i]));
	}	
	cout << dp[n] << endl;
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
     t =1;
   //  cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


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

int stringToInt( string s )
{
    int sum = 0;
    for( int i = 0; i < s.size(); i++ )
    {
        sum *= 10;
        sum += s[i] - '0';
    }
    return sum;
}

int main()
{
    string s;

    cin >> s;

    int cnt = 0;
    int k = s.size() - 1;
    if( ( s[k] - '0' ) % 2 == 0 )
        cnt++;

    while( k > 0 )
    {
        if( s[k] == '0' )
            k--;
        else
        {
            int a = stringToInt( s.substr( 0, k ) ), b = stringToInt( s.substr( k, s.size() ) );
            if( a % 2 == 0 && b % 2 == 0 && a <= b )
                cnt++;
            else if( a % 2 != 0 && b % 2 != 0 && a <= b )
                cnt++;
            k--;
        }
    }

    cout << cnt << endl;

    return 0;
}


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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m, k;
  cin >> n >> m >> k;

  reps(i, 0, n) {
    reps(j, 0, m) {
      if ((n - i) * j + (m - j) * i == k) {
        cout << "Yes" << "\n";
        return 0;
      }
    }
  }

  cout << "No" << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

const ll MOD = 1000000007LL;
ll mod(ll a, ll m) { return (a % m + m) % m; }

template<class T> struct Matrix {
    vector <vector<T>> val;
    Matrix(int n = 1, int m = 1) { val.clear(); val.resize(n, vector<T>(m)); }
    Matrix(int n, int m, T x) { val.clear(); val.resize(n, vector<T>(m, x)); }
    void init(int n, int m, T x = 0) { val.clear(); val.resize(n, vector<T>(m, x)); }
    void resize(int n, int m, T x = 0) { val.resize(n); for (int i = 0; i < n; ++i) val[i].resize(m, x); }
    int size() { return val.size(); }
    inline vector <T> &operator[](int i) { return val[i]; }
    friend ostream &operator<<(ostream &s, Matrix<T> M) { s << endl; for (int i = 0; i < M.val.size(); ++i) s << M[i] << endl; return s; }
};

template<class T> Matrix<T> operator * (Matrix<T> A, Matrix<T> B) {
    Matrix<T> R(A.size(), B[0].size());
    for (int i = 0; i < A.size(); ++i)
        for (int j = 0; j < B[0].size(); ++j)
            for (int k = 0; k < B.size(); ++k)
                R[i][j] = mod(R[i][j] + A[i][k] * B[k][j], MOD);
    return R;
}

template<class T> vector<T> operator * (Matrix<T> A, vector<T> B) {
    vector <T> v(A.size());
    for (int i = 0; i < A.size(); ++i)
        for (int k = 0; k < B.size(); ++k)
            v[i] = (v[i] + A[i][k] * B[k]) % MOD;
    return v;
}

template<class T> Matrix<T> pow(Matrix<T> A, ll n) {
    Matrix<T> R(A.size(), A.size());
    for (int i = 0; i < A.size(); ++i) R[i][i] = 1;
    while (n > 0) { if (n & 1) R = R * A; A = A * A; n >>= 1; }
    return R;
}

int main() {
    int n; ll k;
    cin >> n >> k;
    Matrix <ll> M(n, n, 0);
    for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) cin >> M[i][j];
    vector <ll> vec(n, 1);
    Matrix <ll> P = pow(M, k);
    vector <ll> V = P * vec;
    ll ans = 0LL;
    for (int i = 0; i < n; i++) ans += V[i];
    cout << ans % MOD << "\n";
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
typedef struct pair<int,int> P;
typedef struct pair<int,P> P2;

int n;

ll a[100002]={};
ll b[100002]={};
ll c[100002]={};

const ll INF=100000000001;
int main() {
	int n;

	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++)cin>>b[i];
	for(int i=0;i<n;i++)cin>>c[i];
	ll t=0;
	sort(a,a+n+1);
	sort(c,c+n+1);
	a[n+1]=INF;
	ll ub;
	ll lb;
	ll k,j;
	ll total=0;
	for(int i=0;i<n;++i){
		ub=n+1;
		lb=0;
		while(1){
			ll mid=(ub+lb)/2;
			if((ub-lb)<2)break;
			if(a[mid]<b[i]){
				lb=mid;
			}else{
				ub=mid;
			}
		}
		k=lb;
		ub=n+1;
		lb=0;
		while(1){
			ll mid=(ub+lb)/2;
			if((ub-lb)<2)break;
			if(c[mid]<=b[i]){
				lb=mid;
			}else{
				ub=mid;
			}
		}
		j=n-lb;
		total+=k*j;
	}
	cout<<total<<endl;
	return 0;
}


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

ll val(vector<vector<ll> > &a,vector<vector<ll> > &dp,ll i,ll j){
    ll c,d;
    
    if(j==0) c=1,d=2;
    else if(j==1) c=0,d=2;
    else c=0,d=1;
    
    if(i==0)
    return max(a[0][c],a[0][d]);
    
    if(dp[i][c]==-1) dp[i][c]=a[i][c]+val(a,dp,i-1,c);
    if(dp[i][d]==-1) dp[i][d]=a[i][d]+val(a,dp,i-1,d);
    
    return max(dp[i][c],dp[i][d]);
}

int main() {
    fastio
    
	ll n,i,j,x,t,k,m,y;
	cin>>n;
	
	ll a,b;
	vector<vector<ll> > dp(n-1,vector<ll> (3,-1));
	vector<vector<ll> > v(n,vector<ll> (3));
	
	for(j=0;j<n;j++)
	cin>>v[j][0]>>v[j][1]>>v[j][2];
	
	if(n==1){
	    cout<<max(v[0][0],max(v[0][1],v[0][2]));
	    exit(0);
	}
	
	if(v[n-1][0]<=v[n-1][1] && v[n-1][0]<=v[n-1][2]) x=1,y=2;
	else if(v[n-1][1]<=v[n-1][0] && v[n-1][1]<=v[n-1][2]) x=0,y=2;
	else if(v[n-1][2]<=v[n-1][1] && v[n-1][2]<=v[n-1][0]) x=0,y=1;
	
	a=v[n-1][x]+val(v,dp,n-2,x);
	b=v[n-1][y]+val(v,dp,n-2,y);
	cout<<max(a,b);
	
	return 0;
}


Measured memory_bytes: 21804
// -----------------------------------
// author   : MatsuTaku
// country  : Japan
// created  : 07/22/20 22:03:56
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n,q; cin>>n>>q;
  vector<int> A(n); for (auto& a:A) cin>>a;
  vector<ll> cr(n), c2l(n);
  for (int i = 0; i < n; i++) {
    cr[i] = c2l[i] = A[i];
    if (i > 1)
      c2l[i] += c2l[i-2];
  }
  for (int i = n-2; i >= 0; i--)
    cr[i] += cr[i+1];

  while (q--) {
    int x; cin>>x;
    auto dist = [x](int a) {
      return abs(x-a);
    };
    int l = -1, r = n-1;
    while (l+1<r) {
      auto c = (l+r)/2;
      auto f = c+(n-c)/2;
      if (dist(A[c]) <= dist(A[f])) {
        r = c;
      } else {
        l = c;
      };
    }
    auto f = r+(n-r)/2;
    if (r > 0 and (n-r)%2==1)
      r--;
//    cerr<<r<<endl;
    ll ans = cr[f] + (r > 0 ? c2l[r-1] : 0);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 5288
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,x,y,z;
    cin>>a>>b>>c;
    x=a;y=b;z=c;
    x=b;y=a;
    x=c;
    y=a;
    z=b;
    cout<<x<<" "<<y<<" "<<z<<endl;

return 0;}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)

int a[1010101];
int b[1010101];

int main(){
	fill(a ,a + 1010101,1e9);
	fill(b,b + 1010101,1e9);
	a[0] = 0;
	b[0] = 0;

	int MAX = 1e6;

	for(int i = 1;i <= MAX;i++){
		int temp;
		for(int j = 1;(temp = (j) * (j + 1) * (j + 2) / 6) <= i;j++){
			a[i] = min(a[i] , a[i - temp] + 1);
			if(temp % 2 == 1)
				b[i] = min(b[i] , b[i - temp] + 1);
		}
	}

	int n;
	while(cin >> n , n){
		cout << a[n] << " " << b[n] << endl;
	}
}



Measured memory_bytes: 10956
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = map(int, input().split())
    A = list(map(int, input().split()))

    cnt = 0

    for a in A:
        if a < sum(A) / (4 * M):
            continue
        else:
            cnt += 1
    print("Yes"if cnt >= M else "No")


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
const int maxn = 1e6 + 3;
int n, m;
int a[maxn], cn[maxn];
int c(int i, int j){
	if(j==0||i==j) return 1;
	return  cn[i] - cn[j] - cn[i-j] <= 0;
}
int mod2() {
	int ans = 0;
	for(int i = 0; i < n; i++) {
		if(!(a[i]&1)||!c(n-1, i)) continue;
		ans ^= 1;
	}
	return ans;
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cn[0] = cn[1] = 0;
	cin >> n;
	for(int i = 2; i <= n; i++) cn[i] = cn[i-1] + __builtin_ctz(i);
	char t;
	int o = 0;
	for(int i = 0; i < n; i++) {
		cin >> t;
		a[i] = t-'1';
		if(1==a[i]) o = 1;
	}
	for(int i = 0; o == 0 && i < n; i++) {
		a[i]/=2;
	}
	
	cout << mod2()*(1 + (o==0));
}


Measured memory_bytes: 8064
#include "iostream"
using namespace std;
int main(){
  int a;int b;
  cin>>a>>b;
  if(a>=13){
    cout<<b<<endl;
  }
  if((a>=6)&&(a<=12)){
    cout<<b/2<<endl;
  }
  if(5>=a){
    cout<<0<<endl;
  }

}


Measured memory_bytes: 3520
#include <iostream>
#include <fstream>
#include <algorithm>
#include <map>
//#define LOCAL
using namespace std;
typedef long long ll;
map<string,ll>m;

int main() {
#ifdef LOCAL
ifstream fin("1.txt");
streambuf*p;
p=cin.rdbuf(fin.rdbuf());
#endif // LOCAL
ll q;
cin>>q;
for(ll i=0;i<q;i++){
    ll a;
    string key;
    cin>>a>>key;
    if(0==a){
        ll x;
        cin>>x;
        m[key]=x;
    }else if(1==a){
        cout<<m[key]<<endl;
    }
}

#ifdef LOCAL
fin.close();
#endif // LOCAL
}



Measured memory_bytes: 27668
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
int main(){
    std::string s;
    std::cin >> s;
    std::sort(s.begin(),s.end());
    if(s=="abc")    std::cout << "Yes" <<std::endl;
    else        std::cout << "No" <<std::endl;
            return 0;
        
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N; cin >> N;
	int ans = 0;
	for (int i = 1; i <= N; i += 2) {
		int cnt = 0;
		for (int j = 1; j <= i; j++) {
			if (i % j == 0) cnt++;
		}
		if (cnt == 8) ans++;

	}
	cout << ans << endl;



    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

#define loop(i,n)for(i=0;i<n;i++)
#define INF 1000000000
using ll = long long int;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;





int main()
{
    IOS;
    //freopen("inputfile.txt","r",stdin);
    int n;cin>>n;
    int ar[n];
    for(int i=0;i<n;i++)cin>>ar[i];
    int ans = 100000000;
    for(int i=1;i<100;i++)
    {
        int sum = 0;
        for(int j=0;j<n;j++)sum+=((ar[j]-i)*(ar[j]-i));
        ans = min(ans,sum);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3612
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int main() {
    int n; cin >> n;
    int m = 0;//現在の最大値
    ll ans = 0;
    REP(i, n) {
        int a; cin >> a;
        if (m + 1 == a) {
            m = a;
            continue;
        }
        else if (m >= a) {
            continue;
        }
        else {
            ans += (a-1) / (m + 1);
            if (m == 0) m = 1;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
//#include <algorithm>
#include <vector>

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))

using namespace std;

#define MOD 1000000007

int main(int argc, char* argv[])
{
    long n;
    scanf("%ld", &n);

    long a[25][25]={0};
    vector<ll> dp(1<<n, 0);
 
    long i, j;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            scanf("%ld", &(a[i][j]));
        }
    }

    dp[0]=1;
    for(i=0; i<(1<<n); i++) {
        long k=0;
        for(j=0; j<n; j++) {
            if(i & (1<<j))
                k++;
        }

        for(j=0; j<n; j++) {
            if(!(i & (1<<j)) && a[k][j]) {
                dp[i | (1<<j)] = (dp[i | (1<<j)] + dp[i]) % MOD;
            }
        }
    }

    printf("%lld\n", dp[(1<<n)-1]);

    return 0;
}


Measured memory_bytes: 16768
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using E = System.Linq.Enumerable;
class Program {
    static void Main(string[] args) {
        var N = long.Parse(Console.ReadLine());
        var A = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        
        var len = Convert.ToString(A.Max(),2).Length;
        var sum1 = new long[len];
        var sum0 = new long[len];
        var til1 = new long[len];
        
        for(long i = N-1;i >= 0;i--){
            var S = Convert.ToString(A[i],2);
            
            for(int j = 0;j < len;j++){
                if(j < S.Length && S[S.Length-j-1] == '1'){
                    til1[j] += sum0[j];
                    sum1[j]++;
                }else{
                    til1[j] += sum1[j];
                    sum0[j]++;
                }
            }
        }
        
        long ans = 0;
        long mo = 1000000007;
        for(int i = 0;i < len;i++){
            //Console.WriteLine(til1[i]);
            ans += (til1[i]%mo)*((long)Math.Pow(2,i)%mo);
            ans %= mo;
        }
        Console.WriteLine(ans);
    }
} 


Measured memory_bytes: 60684
# coding: utf-8

#import numpy as np

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

thr = 10**18

res = 1

if 0 in A:
    res = 0
else:
    for a in A:

        res *= a

        if res > thr:
            res = -1
            break

print(int(res))


Measured memory_bytes: 21656
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
using namespace std;
int INF = 1001001001;
int main(){
	int n;
	cin >> n;
	vector<string> s(n);
	vector<int> p(n);
	vector<int> d(n);
	rep(i,n) d[i] = i+1;
	rep(i,n) cin >> s[i] >> p[i];
	vector<int> ans(n);
	rep(i,n){
		int tmp=i;
		for(int j=i+1; j<n; j++){ 
			if(s[tmp] > s[j]) tmp = j;
			if(s[tmp] == s[j] && p[tmp] < p[j]) tmp = j;
		}
		swap(s[tmp], s[i]);
		swap(p[tmp],p[i]);
		swap(d[tmp],d[i]);
	}
	rep(i,n) cout << d[i] << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
int main() {
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif*/
   //cout << std::fixed;
    //cout << std::setprecision(10);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int a,b;
    cin>>a>>b;
    if(b%a==0) cout<<a+b;
    else cout<<b-a;
}

Measured memory_bytes: 256
n = int(input())
p = list(map(int , input().split()))

meet_condition = 0

for i in range(1 , n-1):
    if p[i-1] < p[i] < p[i+1] or p[i-1] > p[i] > p[i+1]:
        meet_condition += 1
        
print(meet_condition)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a[3];
    cin>>a[0]>>a[1]>>a[2];
    int c=a[2];
    sort(a,a+3);
    if(a[1]==c) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    return 0;
}


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

int main() {
	long long k;
	string ss;
	cin>>ss>>k;
	int pos1=0;
	while(ss[pos1]=='1')
		pos1++;
	if (k<=pos1)
		cout<<1<<endl;
	else
		cout<<ss[pos1]<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>

using namespace std;
using Int = long long;

constexpr double EPS = 1e-10;
constexpr long long MOD = 998244353;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

struct Edge{
    int from, to, cost;
    bool operator <(const Edge &e) const {
        return cost < e.cost;
    }
    bool operator >(const Edge &e) const {
        return cost > e.cost;
    }
    bool operator ==(const Edge &e) const {
        return cost == e.cost;
    }
    bool operator !=(const Edge &e) const {
        return cost != e.cost;
    }
};

vector<int> dijkstra(vector<vector<Edge>> &G, int s) {
    int INF = 1e8;
    int V = G.size();
    vector<int> d(V, INF);
    priority_queue<pair<int, int> , vector<pair<int, int>>, greater<pair<int, int>>> pq;
    d[s] = 0;
    pq.push({d[s], s});

    while (!pq.empty()) {
        pair<int, int> p = pq.top(); pq.pop();
        int v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            Edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                pq.push(make_pair(d[e.to], e.to));
            }
        }
    }
    return d;
}

int ans[10000];
vector<vector<Edge>> G;

int main(void) {
    int N, X, Y; cin >> N >> X >> Y;
    G.resize(N+1);
    for (int i = 1; i < N; i++) {
        G[i].push_back({i, i+1, 1});
        G[i+1].push_back({i+1, i, 1});
    }
    G[X].push_back({X, Y, 1});
    G[Y].push_back({Y, X, 1});

    for (int i = 1; i <= N; i++) {
        vector<int> dist = dijkstra(G, i);
        for (int i = 1; i <= N; i++) {
            ans[dist[i]]++;
        }
    }
    for (int i = 1; i < N; i++) {
        cout << ans[i]/2 << endl;
    }
}

Measured memory_bytes: 888
import sys
sys.setrecursionlimit(10**6)
def input():
	return sys.stdin.readline()[:-1]

n = int(input())
colors = [2 for _ in range(n)]
adj = [[] for _ in range(n)]

for _ in range(n-1):
	u, v, w = map(int, input().split())
	adj[u-1].append([v-1, w%2])
	adj[v-1].append([u-1, w%2])

def dfs(v):
	for c, d in adj[v]:
		if colors[c] < 2:
			continue
		if d == 0:
			colors[c] = colors[v]
			dfs(c)
		else:
			colors[c] = abs(1 - colors[v])
			dfs(c)
	return 

colors[0] = 0
dfs(0)
print(*colors, sep="\n")

Measured memory_bytes: 82264
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();

		if (A + B >= 10) {
			System.out.println("error");
		} else {
			System.out.println(A + B);
		}
	}

}

Measured memory_bytes: 23124
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		ArrayList<ArrayList<Integer>> g = new ArrayList<>();
		int[] in = new int[N];
		for (int i = 0; i < N; i++) {
			g.add(new ArrayList<>());
		}
		for (int i = 0; i < M; i++) {
			int x = sc.nextInt() - 1;
			int y = sc.nextInt() - 1;
			g.get(x).add(y);
			in[y]++;
		}
		ArrayList<Integer> q = new ArrayList<>();
		for (int i = 0; i < N; i++) {
			if (in[i] == 0) q.add(i);
		}
		int[] dp = new int[N];
		for (int i = 0; i < q.size(); i++) {
			int parent = q.get(i);
			for (int child : g.get(parent)) {
				dp[child] = Math.max(dp[child], dp[parent] + 1);
				in[child]--;
				if (in[child] == 0) {
					q.add(child);
				}
			}
		}
		int ans = 0;
		for (int i = 0; i < N; i++) {
			ans = Math.max(ans, dp[i]);
		}
		System.out.println(ans);
	}


}

Measured memory_bytes: 103540
class Integer
  def divisor
    res = []
    1.upto((self**0.5)) do |i|
      if self % i == 0
        res.push i
        res.push self / i if i != self / i
      end
    end
    res.sort
  end
end

def answer_if_valid(x, a, d)
  b = a - d
  if x == a ** 5 - b ** 5
    puts "#{a} #{b}"
    exit
  end
end

x = gets.to_s.to_i

r = x % 5

x.divisor.select{|t| r == t % 5}.each do |d|
  (-100000..100000).each{ |a| answer_if_valid(x, a, d) }
end

Measured memory_bytes: 14764
n, m = map(int, input().split())
drinks = [input().split() for i in range(n)]
drinks = [[int(j) for j in i] for i in drinks]
drinks.sort()
money = 0
mm = m
for i in drinks:
    if mm-i[1]<=0:
        money += i[0]*mm
        break
    else:
        money += i[0]*i[1]
        mm += -i[1]
print(money)

Measured memory_bytes: 51060
class Main{
    public static void main(String[] args){
	for(int i=1;i<10;i++){
	    for(int j=1;j<10;j++){
		System.out.println(String.valueOf(i)+"x"+String.valueOf(j)+"="+String.valueOf(i*j));
	    }
	}
    }
}

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

vector<pair<ll, int>> factor(ll n) {
    vector<pair<ll, int>> res;
    for(ll i = 2; i * i <= n; i++) {
        if(n % i != 0) continue;
        int ex = 0;
        while(n % i == 0) {
            ex++;
            n /= i;
        }
        res.push_back({i, ex});
    }
    if(n != 1) res.push_back({n, 1});
    return res;
}

int main()
{
    ll n;
    cin >> n;
    int ans = 0;
    vector<pair<ll, int>> fs;
    fs = factor(n);
    for(auto p : fs) {
        int x = p.second;
        int b = 1;
        while(b <= x) {
            x -= b;
            b++;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main()
{
	
	string s;
	cin >> s;
	
	if(s=="Sunny")
		cout << "Cloudy";
	else if(s=="Cloudy")
		cout << "Rainy";
	else cout << "Sunny";
	
    return 0;
}


Measured memory_bytes: 3600
S = input()
l = len(S)
c = 0
if S[0] == 'A':
  n = 1
  while n < l:
    if S[n] == 'C' and n not in [1, l-1]:
      c += 1
    elif S[n].isupper():
      c = 0
      break
    n += 1
  if c == 1:
    print('AC')
  else:
    print('WA')
else:
  print('WA')

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int mod= 1e+9+7;

int main() {
    int N;cin>>N;
    vector<int>p(N);
    rep(i,N)cin>>p[i];
    int cnt=0;
    for(int i=1;i<=N;i++){
        if(i==p[i-1] && i!=N){
            swap(p[i-1],p[i]);
            cnt++;
        }
        else if(i==N&&N==p[N-1])cnt++;
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define ALL(a) a.begin(), a.end()
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1e14;
const ll MOD = 1e9 + 7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    // input
    ll a, b;
    cin >> a >> b;
    // output
    if ((a + b) % 2 == 0) {
        cout << (a + b) / 2 << endl;
        return 0;
    }

    cout << "IMPOSSIBLE" << endl;
    return 0;
}

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

int main(){
  int k, n; cin>>k >>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  
  int l=a[0]+k-a[n-1];
  for(int i=0;i<n-1;i++){
    l=max(l, a[i+1]-a[i]);
  }
  
  cout<<k-l<<endl;
  return 0;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N - 1)]
px = [list(map(int, input().split())) for i in range(Q)]
 
root = [[] for i in range(N + 1)]
result = [0 for i in range(N + 1)]
 
for i in range(N - 1):
    a = ab[i][0]
    b = ab[i][1]
    root[a].append(b)
    root[b].append(a)
 
for i in range(Q):
    p = px[i][0]
    x = px[i][1]
    result[p] = result[p] + x
 
 
def dfs(now, prev):
    if len(root[now]) == 0:
        return
    else:
        for i in range(len(root[now])):
            next_point = root[now][i]
            if next_point == prev:
                continue
            else:
                result[next_point] = result[next_point] + result[now]
                dfs(next_point, now)
 
 
dfs(1, -1)
print(*result[1:])

Measured memory_bytes: 277652
#include <stdio.h>
#include <string.h>
 
char next_char(char c, int n) {
  for (int i = 0; i < n; i++) {
    if (c == 'z') { c = 'a'; }
    else { c += 1; }
  }
  return c;
}
 
int main() {
  char WORD[100000];
  int N;
 
  scanf("%s", WORD);
  scanf("%d", &N);
 
  int len = strlen(WORD);
 
  int n = N;
 
  for (int i = 0; i < len; i++) {
    if (WORD[i] == 'a') { continue; }
 
    int required_n = (122 - WORD[i] + 1);
 
    if (n >= required_n) {
      WORD[i] = 'a';
      n -= required_n;
    }
    else {
      continue;
    }
  }
 
  if (n >= 0) {
    WORD[len-1] = next_char(WORD[len-1], n);
  }
 
  printf("%s\n", WORD);
 
  return 0;
}
 


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

int main(){
    string s;
    cin >> s;
    int ans = 0;
    int d[2][4];
    rep(i,4){
      ans +=stoi(s.substr(i,1));
      d[0][i] = stoi(s.substr(i,1));
      d[1][i] = 0 - stoi(s.substr(i,1));
    }
    int a = stoi(s.substr(0,1));
    int ope[3];
    for (int i = 0;i < 2;i++){
       for (int j = 0;j < 2;j++){
          for (int k = 0;k < 2;k++){
             if (a+d[i][1]+d[j][2]+d[k][3] == 7){
                cout << a;
                if (d[i][1] >=0) cout << "+" << d[i][1];
                else cout << d[i][1];
                if (d[j][2] >= 0) cout << "+" << d[j][2];
                else cout << d[j][2];
                if (d[k][3] >= 0) cout << "+" << d[k][3];
                else cout << d[k][3];
                cout << "=7" << endl;
                return 0;
              }
          }
       }
    }
    
    return 0;
    
}



Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{

    while(1)
    {
        int i,n=0;
    char x[1000];
        scanf("%s",&x);
        if(x[0]=='0')
            break;
        else
        {
            for(i=0;i<strlen(x);i++)
            {
                n+=x[i]-'0';
            }
            printf("%d\n",n);
        }
    }
    return 0;
}




Measured memory_bytes: 2048
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ld long double
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

// #include <iomanip>
//  cout << fixed << setprecision(15) << y << endl;

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> N;

    ll ans = 0;

    for( ll ai = 1 ; ai <N ; ai++ ){
        ans += (N-1)/ai;
    }
    cout << ans << endl;
    

}

Measured memory_bytes: 3652
S = input()
y = 0
sum_t = 0
up = False
pre = 0
for c in S:
	if c == '<':
		if up:
			y += 1
		else:
			y = 1
			up = True
		sum_t += y
	elif c == '>':
		if up:
			pre = y
			y = 1
			up = False
		else:
			y += 1
			sum_t += y
			if y <= pre:
				sum_t -=1
print(sum_t)

Measured memory_bytes: 4116
/* -> Written by <-
   -----------
  |K_A_Z_A_M_A|
  |___________|
  |    _    |
  |   (^_^)   |
  |  /( | )\  |
  |____|_|____|
    H O A N G
*/

#define Task ""
#define F first
#define S second
#define push_back pb
#define bit(x, i) (x >> i) & 1
#define inf 1e9 + 7
#define INF 1e18 + 7

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <string>
#include <sstream>
#include <cstdio>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <unordered_map>
#include <stack>

using namespace std;

typedef long long ll;

const int MOD = 1e9 + 7;
const int maxn = 2e5 + 5;

int n, m;
ll a[maxn], b[maxn], sa[maxn], sb[maxn];
ll k;

void Solve()
{
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i ++) cin >> a[i], sa[i] = sa[i-1] + a[i];
    for (int i = 1; i <= m; i ++) cin >> b[i], sb[i] = sb[i-1] + b[i];
    int res = 0;
    for (int i = 0; i <= n; i ++)
    {
        if (sa[i] > k) break;
        ll cur = k - sa[i];
        int l = 0, r = m + 1;
        while (r - l > 1)
        {
            int mid = (l + r) >> 1;
            if (sb[mid] > cur) r = mid;
            else l = mid;
        }
        res = max(res, i + l);
    }
    cout << res;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    if(fopen(Task".inp", "r"))
    {
        freopen(Task".inp","r",stdin);
        freopen(Task".out","w",stdout);
    }
    int test_case = 1;
//    cin >> test_case;
    while (test_case --)
        Solve();
    return 0;
}


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

struct BinaryIndexedTree {
    vector<int> data;
    int n;
    BinaryIndexedTree(int n) : data(n+1), n(n+1) {}

    void update(int i,long x){
        for(; i <= n; i += i & -i) data[i] += x;
    }

    long query(int i){
        long ret = 0;
        for(; i > 0; i -= i & -i) ret += data[i];
        return ret;
    }
};

int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    long n; cin >> n;
    long a[100010]; for(int i = 0; i < n; ++i) cin >> a[i];

    int l = 0, r = 2e9;
    while(r - l > 1) {
        long mid = (l + r) / 2;
        BinaryIndexedTree bit(n * 2);
        long sum = n + 1, num = 0;
        bit.update(sum, 1);

        for(int i = 0; i < n; ++i) {
            sum += (a[i] <= mid ? 1 : -1);
            num += bit.query(sum - 1);
            bit.update(sum, 1);
        }

        if(num > n * (n + 1) / 2 - num) r = mid;
        else l = mid;
    }

    cout << r << endl;
    return 0;
}

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

using namespace std;

int main() {
  string s;
  cin >> s;
  string ans;
  if (s == "Sunny") {
    ans = "Cloudy";
  } else if (s == "Cloudy") {
    ans = "Rainy";
  } else {
    ans = "Sunny";
  }
  cout << ans << endl;
}


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

int main() {
	int N;  cin >> N;
	int S = 0;
	int buf = N;
	while (buf > 0) {
		S += buf % 10;
		buf /= 10;
	}
	if (N%S == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
    int H,W,K;
    cin >> H >> W >> K;
    char c[H][W];
    for ( int i = 0; i < H; ++i){
        for ( int j = 0; j < W; ++j){
            cin >> c[i][j];
        }
    }
    
    int ans = 0;
    for ( int bith = 0; bith < (1<<H); ++bith){
        for ( int bitw = 0; bitw < (1<<W); ++bitw){
            char cs[H][W];
            for ( int i = 0; i < H; ++i){
                for ( int j = 0; j < W; ++j){
                    cs[i][j] = c[i][j];
                }
            }
            for ( int i = 0; i < H; ++i){
                if ( bith & (1<<i) ){
                    for ( int j = 0; j < W; ++j){
                        cs[i][j] = 'x';
                    }
                }
            }
            for ( int j = 0; j < W; ++j){
                if ( bitw & (1<<j)){
                    for ( int i = 0; i < H; ++i){
                        cs[i][j] = 'x';
                    }
                }
            }
            int num = 0;
            for ( int i = 0; i < H; ++i){
                for ( int j = 0; j < W; ++j){
                    if ( cs[i][j] == '#' ) ++num;
                }
            }
            if ( num == K ) ++ ans;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	int b,r,g,c,s,t;

	while(cin>>b>>r>>g>>c>>s>>t){
	    int f=100;
        if(b==0&&r==0&&c==0&&s==0&&g==0&&t==0)break;
        f+=b*5*15;
        f+=r*3*15;
        f+=g*7;
        f+=c*2;
        f+=s*3;
        f-=(t-(b*5)-(r*3))*3;
        f-=b*2*5;
        f-=r*2*3;
        f+=b*15;
        f+=r*15;

        cout<<f<<endl;
	}


	return 0;
}

Measured memory_bytes: 1164
n=int(input())
a=[list(map(int,input().split())) for i in range(n)]

ans=0

for i in range(n-1,-1,-1):
    if ((a[i][0]+ans)%a[i][1])==0:
        pass
    else:
        ans+=a[i][1]-((a[i][0]+ans)%a[i][1])

print(ans)

Measured memory_bytes: 27380
#include <iostream>
#include <bits/stdc++.h>
#include <assert.h>
#include <algorithm>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <iomanip>
#define initrand mt19937 mt_rand(time(0));
#define rand mt_rand()
#define int long long
#define INF 10000000000000
#define mid(l, u) ((l+u)/2)
#define lchild(i) (i*2 + 1)
#define rchild(i) (i*2 + 2)
using namespace std;
signed main(){
    int t;
    cin>>t;
    if(t>=30) cout<<"Yes\n";
    else cout<<"No\n";
}

Measured memory_bytes: 3620
mod = 1000000000 + 7

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(input())
dat = [0] * 2000 # 約数として求められたある数の合計

# N! の各要素の素因数分解をする
res = 1
for i in range(1, n + 1):
    d = factorization(i)
    for j in range(len(d)):
        dat[d[j][0]] += d[j][1]

for i in range(2, n + 1):
    res *= (dat[i] + 1)
    res %= mod

print(res)

Measured memory_bytes: 3188
import java.util.Scanner;

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

    int N = scanner.nextInt();
    int min = Integer.MAX_VALUE;
    int max = 0;
    for (int i = 0; i < N; i++) {
      int a = scanner.nextInt();
      if (a < min) min = a;
      if (a > max) max = a;
    }
    System.out.println(max - min);
  }
}


Measured memory_bytes: 21844
import sys
input = sys.stdin.readline
from collections import defaultdict

N = int(input())
a = list(map(int, input().split()))
d = defaultdict(list)
dp = [-1]*N

for i in range(N):
    if a[i]==1:
        dp[i] = 1
    else:
        if len(d[a[i]-1])==0:
            continue

        dp[i]=dp[d[a[i]-1][-1]]+1
    
    d[a[i]].append(i)

ans = 10**18

for i in range(N):
    if dp[i]==-1:
        continue
    
    ans = min(ans, N-dp[i])

if ans==10**18:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 106828
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
const int MaxN = 1e5;

int main()
{
	int n,a,b;
	while(~scanf("%d",&n))
	{
		scanf("%d%d",&a,&b);
		n -= a;
		n %= b;
		printf("%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

K = int(input())
A, B = map(int, input().split())

for i in range(A, B + 1):
    if i % K == 0:
        print('OK')
        sys.exit(0)
print('NG')





Measured memory_bytes: 10844
#-*- coding: utf-8 -*-

#matching
def matching(x,y):
    for s in range(m):
        for t in range(m):
            if not a[x+s][y+t] == b[s][t]:
                return 0

    return 1


if __name__ == '__main__':
    #read
    n, m = map(int,raw_input().split())
    a=[]
    for i in range(n):
        a.append(list(raw_input()))
    b=[]
    for j in range(m):
        b.append(list(raw_input()))


    #slide  an origin point
    for i in range(n - m + 1):
        for j in range(n - m + 1):
            #print a[i][j]
            ans = matching(i,j)
            if ans == 1:
                print 'Yes'
                exit()

    if ans == 0:
        print 'No'

    '''
    基準点をスライドさせていく
    一列目がマッチングするか確認
    その後の列もマッチングするか確認
    全てマッチすればYesと返す
    '''


Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
const ll INFLL = (ll) 1e18 + 1;
struct edge{
    ll to;
    ll a;
    ll b;
};
vector<ll> A,B,C,D;
vector<vector<edge>> edge1,edge2;

vector<ll> dijkstra(ll s){
    priority_queue<l_l, vector<l_l>, greater<l_l>> pq;
    vector<ll> dist(55*2500, INFLL);
    dist[s] = 0;
    pq.push({dist[s], s});
    while(!pq.empty()){
        auto tmp = pq.top();
        pq.pop();
        ll from = tmp.second;
        ll d = tmp.first;
        if(dist[from] < d)continue;
        for(auto p: edge2[from]){
            if(dist[p.to] > dist[from] + p.b){
                dist[p.to] = dist[from] + p.b;
                pq.push(l_l(dist[p.to], p.to));
            }
        }
    }
    return dist;
}
ll f(ll v, ll s){
    return v*2500 + s;
}
int main(){
    ll n, m ,s, u, v;
    cin >> n >> m >> s;
    edge1.resize(n);
    A.resize(m);
    B.resize(m);
    C.resize(n);
    D.resize(n);
    for(ll i = 0;i < m;i++){
        cin >> u >> v >> A[i] >> B[i];
        u--;v--;
        edge1[u].push_back({v,A[i],B[i]});
        edge1[v].push_back({u,A[i],B[i]});
    }
    for (int i = 0; i < n; ++i) {
        cin >> C[i] >> D[i];
    }
    edge2.resize(n*(2500+5));
    for(ll i = 0;i < n;i++){
        for(ll j = 0;j <= 2499;j++){
            ll to = min(j + C[i], 2499ll);
            edge2[f(i,j)].push_back({f(i, to), 0, D[i]});
            for(auto e: edge1[i]){
                if(j - e.a < 0)continue;
                edge2[f(i,j)].push_back({f(e.to, j-e.a), e.a, e.b});
            }
        }
    }
    s = min(s, 2499LL);
    auto dist = dijkstra(f(0,s));
    for(ll i = 1;i < n;i++){
        ll ans = INFLL;
        for(ll j = 0;j < 2500;j++){
            ans = min(ans, dist[f(i, j)]);
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 30136
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define int long long
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

signed main(){
	int n;
	cin>>n;
	int a[n];
	rep(i,n){
		cin>>a[i];
	}
	int ans,sum,res;
	ans=sum=res=0;
	rep(i,n){
		sum+=a[i];
		if(i%2){
			if(sum>=0){
				while(sum>=0){
					sum--;
					ans++;
				}
			}
		}else{
			if(sum<=0){
				while(sum<=0){
					sum++;
					ans++;
				}
			}
		}
	}
	sum=0;
	rep(i,n){
		sum+=a[i];
		if(i%2==0){
			if(sum>=0){
				while(sum>=0){
					sum--;
					res++;
				}
			}
		}else{
			if(sum<=0){
				while(sum<=0){
					sum++;
					res++;
				}
			}
		}
	}
	ans=min(ans,res);
	cout<<ans<<endl;
	return 0;
}

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

typedef long long ll;

using namespace std;

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

template<class T>
using vt = vector<T>;
template<class T>
using vvt = vector<vector<T>>;

int main(){
    int N;
    cin >> N;
    int ans = (N+1)/2;
    cout << ans << endl;
    return 0;
}




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

using namespace std;

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

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

char s[100005];

int main() {
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	int ans = n;
	for (int i = 1; i < n; i++)
		if(s[i] != s[i + 1])
			ans = min(ans, max(i, n - i));
	cout << ans;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    ll N,A,B; cin >> N >> A >> B;
    if (A > B || (N == 1 && A != B)) {
        cout << 0 << '\n';
        return 0;
    } 
    ll s = A * (N - 1) + B;
    ll t = A + B * (N - 1);
    cout << (t - s + 1) << '\n';
    return 0;
}

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


int main(){
	string S;
  	cin>>S;
  	int act=0,bct=0,cct=0;
  	for(int k=0;k<S.size();k++){
      if(S.at(k)=='a') act++;
      else if(S.at(k)=='b') bct++;
      else cct++;
    }
  
	if(abs(act-cct)<=1&&abs(bct-cct)<=1&&abs(act-bct)<=1){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
}

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

int main(){
	
	int n, m, now;
	vector<int> vc;

	while(cin >> n >> m){
		vc.clear();
		if(n == 0) break;
		for(int i=0; i<n; i++){
			vc.push_back(i);
		}

		now = 0;
		while(vc.size()){
			now = (now + m-1) % (vc.size());
			vc.erase(vc.begin() + now);
/*			
			for(int i=0; i<n; i++){
				cout << vc[i] << " ";
			}
			cout << "[" << now << "]" << n << endl;
*/		}
	
		cout << vc[0]+1 << endl;
	}
	
	return 0;
	
}

Measured memory_bytes: 1228