akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	FOR(i,1,1e8){
		if(i*8/100==a && i*10/100==b){
			cout<<i<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 256
#-------------------------------------------------------------------------------
#関数定義
def f(a,d,T):
    try:
        return T[d+1:].index(a)+(d+1)
    except ValueError:
        return len(T)

def g(a,d,T):
    try:
        return (d-1)-T[d-1::-1].index(a)
    except ValueError:
        return 0
#-------------------------------------------------------------------------------
#インポート
from math import inf,exp
from random import random,randint
import time
from copy import copy
#-------------------------------------------------------------------------------
#定数
TIME_LIMIT=1.862 #ループの時間制限  
A=26 #アルファベットの数
START=time.time()

ep=10**(-6) #アニーリングの微小温度
#-------------------------------------------------------------------------------
#読み込み部
D=int(input())

C=[True]+list(map(int,input().split())) #減る満足度のベース
S=[True]*(D+1) #S[d][i] :(d+1)日目にコンテストiを開催した時の満足度

for i in range(1,D+1):
    S[i]=[0]+list(map(int,input().split()))           
#-------------------------------------------------------------------------------
#貪欲部
L=[0]*(A+1)
T=[0]
for d in range(1,D+1):
    Y=-inf
    E=0
    for a in range(1,A+1):
        X=S[d][a]
        for s in range(1,A+1):
            if a!=s:
                X-=C[s]*(d-L[s])

        if X>Y:
            Y=X
            E=a
    L[E]=d
    T.append(E)
#-------------------------------------------------------------------------------
#調節部
t=time.time()-START
while time.time()-START<TIME_LIMIT:
    d=randint(1,D)
    p=T[d]
    q=randint(1,A)
    Y=(d-g(p,d,T))*(f(p,d,T)-d)
    Z=(d-g(q,d,T))*(f(q,d,T)-d)
        
    Delta=(S[d][q]-S[d][p])+Z*C[q]-Y*C[p]
    if (Delta>=0) or (Delta<0 and random()<exp(Delta/(TIME_LIMIT-t+ep))):
        T[d]=q

    t=time.time()-START
    
for i in range(1,D+1):
    print(T[i])

Measured memory_bytes: 89356
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


// Union-Find Disjoint Sets Library written in OOP manner, using both path compression and union by rank heuristics
// initialize: UnionFind UF(N)

class UnionFind {                                              // OOP style
private:
	vector<int> p, rank, setSize;
	// p = path toward the root of disjoint set; p[i] = i means it is root
	// rank = upper bound of the actual height of the tree; not reliable as accurate measure
	// setSize = size of each disjoint set

	int numSets;
public:
	UnionFind(int N) {
		setSize.assign(N, 1);
		numSets = N;
		rank.assign(N, 0);
		p.assign(N, 0);
		for (int i = 0; i < N; i++) p[i] = i;	// each belongs to its own set
	}

	int findSet(int i) {
		return (p[i] == i) ? i : (p[i] = findSet(p[i]));		// path compression: cut short of the path if possible
	}

	bool isSameSet(int i, int j) {
		return findSet(i) == findSet(j);
	}

	void unionSet(int i, int j) {
		if (!isSameSet(i, j)) {
			numSets--;
			int x = findSet(i), y = findSet(j);
			// rank is used to keep the tree short
			if (rank[x] > rank[y]) { p[y] = x; setSize[x] += setSize[y]; }
			else {
				p[x] = y; setSize[y] += setSize[x];
				if (rank[x] == rank[y]) rank[y]++;
			}
		}
	}

	int numDisjointSets() {		// # of disjoint sets
		return numSets;
	}

	int sizeOfSet(int i) {		// size of set
		return setSize[findSet(i)];
	}
};


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

	int n, m, i, j, k, a, b, c, d, x;
	cin >> n >> m >> k;

	UnionFind uf(n + 1);
	vector<vector<int>> block(n + 1);
	vector<int> ct(n + 1, 0), ans(n + 1, 0);

	for (i = 0; i < m; i++) {
		cin >> a >> b;
		ct[a]++;
		ct[b]++;
		uf.unionSet(a, b);
	}

	for (i = 0; i < k; i++) {
		cin >> a >> b;
		block[a].push_back(b);
		block[b].push_back(a);
	}

	for (i = 1; i <= n; i++) {
		x = uf.sizeOfSet(uf.findSet(i)) - ct[i] - 1;
		for (auto p : block[i]) {
			if (uf.isSameSet(i, p)) x--;
		}
		ans[i] = x;
		cout << ans[i] << " ";
	}
	cout << "\n";


	return 0;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
#ifdef _WIN32
#include "debug.hpp"
#endif
using namespace std;

#define rep(i, N)  for(int i = 0; i < (N); i++)
#define reps(i, N) for(int i = 1; i <= (N); i++)
#define repr(i, N) for(int i = (N) - 1; i >= 0; i--)
#define pub push_back

template<typename T> 
void chmax(T &a, T b){ a = max(a, b); };
template<typename T> 
void chmin(T &a, T b){ a = min(a, b); };

typedef long long ll;
typedef pair<int, int> P;
const int INF = 100000000;
const ll LINF = 10000000000000000;
const int MOD = 1000000007;
const int dx[9] = { 0, 1,  0, -1, 1,  1, -1, -1, 0};
const int dy[9] = { 1, 0, -1,  0, 1, -1, -1,  1, 0};
//--------------------------------------//
ll H, W;

void solve(){
	ll ans = LINF;
	rep(i, 2){
		chmin(ans, (!!(H % 3)) * W);
		ll w = W / 2;
		reps(j, H - 1){
			ll h = H - j;
			ll s[] = {j * W, h * w, h * (w + W % 2)};
			ll d = max(abs(s[0] - s[1]), max(abs(s[1] - s[2]), abs(s[0] - s[2])));
			chmin(ans, d);
		}
		swap(H, W);
	}
	cout << ans << endl;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> H >> W;
		solve();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

using namespace std;

#define rep(i, a, b) for (int i = a; i < b; i++)
#define rrep(i, a, b) for (int i = a; i <= b; i++)
#define all(a)  begin((a)),end((a))
#define uniq(c) (c).erase(unique(all((c))), end((c)))

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

    if (S <= W) cout << "unsafe" << endl;
    else cout << "safe" << endl;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=508,inf=0x3f3f3f3f;
int read(){
    int f=1,g=0;char ch=getchar();
    for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
    for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
    return f*g;
}
int ans,n,p,f[N][N];
pair<int,int> a[N];
void check(int &x,int y){if((x+=y)>=p) x-=p;}
int solve(int K){
	int cnt1=0,cnt2=0;
	memset(f,0,sizeof(f));
	f[0][0]=1;
	for (int i=0;i<2*n;i++)
	if (!a[i].second){
		for (int j=0;j<=cnt2;j++)
		f[i+1][j]=(ll)f[i][j]*(a[i].first-(j+cnt1)+1)%p;
		cnt1++;
	}
	else{
		for (int j=0;j<=cnt2;j++)
		f[i+1][j+1]=(ll)f[i][j]*(a[i].first-(cnt1+j)+1)%p;
		for (int j=0;j<=cnt2;j++)
		check(f[i+1][j],(ll)f[i][j]*(a[i].second-(n+cnt2-j+K)+1)%p);
		cnt2++;
	}
	return (K&1) ? (p-f[2*n][K]) : f[2*n][K];
}
int main(){
	n=read();p=read();
	for (int i=0;i<n*2;i++)
	if (i<n) a[i]=make_pair((int)sqrt(n*n-1-i*i),min(n*2-1,(int)sqrt(n*n*4-i*i)));
	else a[i]=make_pair(min(n*2-1,(int)sqrt(n*n*4-i*i)),0);
	sort(a,a+n*2);
	for (int i=0;i<=n;i++) check(ans,solve(i));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1280
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    def find(i):
        x = S[i]
        if x < 0:
            return i
        S[i] = find(x)
        return S[i]

    def join(i, j):
        ai = find(i)
        aj = find(j)
        diff = ai - aj
        if diff == 0:
            return
        elif diff > 0:
            ai, aj = aj, ai
        S[ai] += S[aj]
        S[aj] = ai
    def same(i, j):
        ai = find(i)
        aj = find(j)
        return ai == aj
    def size(i):
        return -S[find(i)]

    N, M, K = iim()
    S = [-1] * N
    T = [1] * N
    for i in range(M):
        ai, bi = iim()
        ai -= 1; bi -= 1
        join(ai, bi)
        T[ai] += 1
        T[bi] += 1
        #print(ai, bi, S)

    for i in range(K):
        ai, bi = iim()
        ai -= 1; bi -= 1
        if same(ai, bi):
            T[ai] += 1
            T[bi] += 1
    #print(S)
    #print(T)

    ans = [size(i) - T[i] for i in range(N)]
    print(*ans)


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 10972
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

int ask(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int ret;
    cin >> ret;
    return ret;
}
void answer(vi path) {
    cout << "! ";
    rep(i, 0, sz(path)) {
        if (i != 0) cout << " ";
        cout << path[i] + 1;
    }
    cout << endl;
}
signed main() {
    int N, S, T;
    cin >> N >> S >> T;
    S--, T--;

    vi dS(N), dT(N);
    rep(i, 0, N) {
        dS[i] = ask(S, i);
        dT[i] = ask(T, i);
    }

    vector<pii> vs;
    rep(i, 0, N) {
        if (dS[i] + dT[i] == dS[T]) {
            vs.push_back({dS[i], i});
        }
    }
    sort(all(vs));

    dump(vs);

    assert(vs.front() == pii(0, S));
    vi path;
    path.push_back(S);
    int dist = 0;
    rep(i, 1, sz(vs)) {
        int v = vs[i].second;
        int tmp = ask(path.back(), v);
        if (dist + tmp + dT[v] == dS[T]) {
            path.push_back(v);
            dist += tmp;
        }
    }

    answer(path);
    return (0^_^0);
}




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

int main() {
    string s; cin >> s; bool can = true;
    char c[] = {'a','b','c','d','e','f','g','h','i',
    'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
    map<char,bool> m;
    for(int i=0;i<s.size();i++){
        m[s.at(i)]=true; 
    }
    for(int i=0;i<26;i++){
        if(m[c[i]]);
        else {cout << c[i] << endl;can = false;break;}
    }
    if(can)cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
n = int(input())
x = map(int, input().split())
y = map(int, input().split())
 
x_y = [abs(xi - yi) for xi, yi in zip(x, y)]
p1 = sum(x_y)
p2 = sum(i ** 2 for i in x_y) ** (1 / 2)
p3 = sum(i ** 3 for i in x_y) ** (1 / 3)
p_inf = max(x_y)
 
print(p1)
print(p2)
print(p3)
print(p_inf)


Measured memory_bytes: 5644
#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(void){
  string s1, s2, s3;
  cin >> s1 >> s2 >> s3;
  string x = string() + s1.at(0);
  //string str(1, x);
  char y = s2.at(0);
  char z = s3.at(0);
  cout << x + y + z << endl;
}


Measured memory_bytes: 3572
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;


public class Main {
	private	static	BufferedReader	br = null;

	static {
		br = new BufferedReader(new InputStreamReader(System.in));
	}
 
    /**
     * @param args
     */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int		cnt = parseNum();
		int[]	out = {-1, -1};
		int[]	tmp = null;

		for (int n = 0; n < cnt; n++) {
			tmp = parseScore();
			if (out[1] < tmp[1] || out[1] == tmp[1] && out[0] > tmp[0]) {
				out[0] = tmp[0];
				out[1] = tmp[1];
			}
		}

		System.out.printf("%d %d\n", out[0], out[1]);
	}

	private static int[] parseScore() {
		int[]	params = new int[2];
		String	strin  = null;

		if ((strin = parseStdin()) != null) {
			String[]	lines = strin.split(" ");
			params[0] = Integer.parseInt(lines[0]);
			params[1] = Integer.parseInt(lines[1]);
		}
 
		return params;
	}

	private static int parseNum() {
		int		param = 0;
		String	strin = null;

		if ((strin = parseStdin()) != null) {
			param = Integer.parseInt(strin);
		}
 
		return param;
	}

	private static String parseStdin() {
        String  stdin = null;
        
        try {
        	String  tmp = br.readLine();
        	if (!tmp.isEmpty()) stdin = tmp;
        }
        catch (IOException e) {}
 
        return stdin;
	}
}

Measured memory_bytes: 18620
import sys

class Node:
    __slots__ = ['key', 'left', 'right']
    def __init__(self, key):
        self.key = key
        self.left = self.right = None

root = None

def insert(key):
    global root
    x, y = root, None
    while x: x, y = x.left if key < x.key else x.right, x
    if y is None: root = Node(key)
    elif key < y.key: y.left = Node(key)
    else: y.right = Node(key)

def find(target):
    result = root
    while result and target != result.key:
        result = result.left if target < result.key else result.right
    return result is None

def inorder(node):
    return inorder(node.left) + f' {node.key}' + inorder(node.right) if node else ''
def preorder(node):
    return f' {node.key}' + preorder(node.left) + preorder(node.right) if node else ''

input()
for e in sys.stdin:
    if e[0] == 'i': insert(int(e[7:]))
    elif e[0] == 'f': print(['yes','no'][find(int(e[5:]))])
    else: print(inorder(root)); print(preorder(root))


Measured memory_bytes: 55624
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#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 mp make_pair
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(3e5) + 999;
#define int long long int
int fact[100001];
int inv[100001];

void f(){
	fact[0]=1;
	for(int i=1;i<=100000;i++){
		fact[i] = fact[i-1]*i;
		fact[i]%=MOD;
	}
	for(int i=0;i<=100000;i++){
		inv[i] = power(fact[i],MOD-2,MOD);
		inv[i]%=MOD;
	}
}


int32_t main(){
    IOS;
    f();
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    for(int i=1;i<=n;i++)
    	cin>>arr[i];
    sort(arr+1,arr+n+1);
    int ans=0;

    for(int i=n;i>=k;i--){
    	int x = arr[i];
    	x = (x*fact[i-1])%MOD;
    	x = (x*inv[k-1])%MOD;
    	x = (x*inv[i-k])%MOD;;
    	ans = (ans + x)%MOD;
    	while(ans<0)
    		ans+=MOD;
    	ans%=MOD;
    }
    // cout<<ans<<endl;
    for(int i=1;n-i>=k-1;i++){
    	int x = arr[i];
    	x = (x*fact[n-i])%MOD;
    	x = (x*inv[k-1])%MOD;
    	x = (x*inv[n-i-k+1])%MOD;
    	ans =( ans - x)%MOD;
    	while(ans<0)
    		ans = ans+=MOD;
    	ans%=MOD;
    }
    cout<<ans<<endl;

    return 0;
}

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

int main(){
	priority_queue<int> Q;
	string word;
	while (cin >> word) {		
		if (word == "insert"){
			int num;
			cin >> num;
			Q.push(num);
		}
		else if (word == "extract"){
			int n = Q.top();
			Q.pop();
			cout << n << endl;
		}
		else break;
	}
}

Measured memory_bytes: 6504
#include <bits/stdc++.h>
#define COUT(str) cout << str << endl
#define REP(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;
int ten_num_change(int n) {
	if (n % 10 == 0) return n;
	return (n / 10 + 1) * 10;
}
int main() {
	int a[6], sum;
	REP(i, 0, 5) cin >> a[i];
	int max_num = -1, check;
	REP(i, 0, 5) {
		sum += ten_num_change(a[i]);
		if (max_num < ten_num_change(a[i]) - a[i]) {
			max_num = ten_num_change(a[i]) - a[i];
			check = i;
		}
	}
	COUT(sum- ten_num_change(a[check])+a[check]);

	return 0;
}

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

int main(void) {
	int N;
	scanf("%d", &N);
	int L[100];
	for (int i = 0; i < N; i++) {
		scanf("%d", &L[i]);
	}
	sort(L, L + N);
	int ans = 0;
	for (int i = 0; i < N - 2; i++) {
		for (int j = i + 1; j < N - 1; j++) {
			for (int k = j + 1; k < N; k++) {
				if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i]) continue;
				else if (L[i] + L[j] > L[k]) {
					// cout << L[i] << " " << L[j] << " " << L[k] << "\n";
					ans++;
				}
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


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

typedef long long ll;
#define rep(i, s, n) for(int i=s;i<n;i++)
#define repeq(i,s,n) for(int i=s;i<=n;i++)
#define MOD 10e9+7

void max_self(int& a, int b) { a=a>b?a:b; }
void min_self(int& a, int b) { a=a<b?a:b; }

using namespace std;

int n, k;
const int MAX_N = 2e5+5;

bool curr[MAX_N];
bool a[MAX_N];
int temp;

int cnt;

int main() {

    cin >> n;

    for(int i = 1; i <= n; i++) {
        cin >> temp;
        a[i]=temp%2;
    }

    for(int i = n; i > 0; i--) {
        cnt = 0;
        int b = i;
        while(b <= n) {
            cnt+=curr[b];
            b+=i;
        }
        curr[i]=(cnt+(int)a[i])%2;
    }
    vector<int> yo;
    yo.reserve(MAX_N);

    cnt = 0;
    for(int i = 1; i <= n; i++){
        if(curr[i])
            cnt++, yo.push_back(i);
    }
    cout << cnt << endl;
    for( auto x : yo )
        cout << x << endl;

    return 0;

}


Measured memory_bytes: 1920
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
if n==1:
    print(0)
else:
    while(su<n):
        n_ = math.ceil(n*(stage-1)/stage)
        if n_ == su:
            nums.append(1)
            nums.append(n-su-1)
            break
        nums.append(n_-su)
        su+=n_-su
        if su>=ch:
            nums.append(n-su)
            break
        stage += 1
    ans=[]
    next_div_num = 0
    k=len(nums)
    for i in range(k):
        next_div_num += nums[k-1-i]
        if nums[k-1-i] == 1:
            continue
        sho = n//next_div_num
        d = next_div_num
        if d==0 or sho>d:
            continue
        if sho == n%d:
            ans.append(d)
        elif sho>n%d:
            d-=1
            if d==0 or sho>d:
               continue
            if sho == n%d:
                ans.append(d)
    print(sum(ans))

Measured memory_bytes: 127228
#include<stdio.h>
#include<string.h>

int main(void)
{
	char s[101];
	char t[202];
	int len,c=0,i,j;
	scanf("%s%s",s,t);
	len=strlen(s);
	for(i=0;i<len;i++)
		t[len+i]=t[i];
	
	for(i=0;i<len;i++){
		for(j=0;j<len;j++){
			if(s[j]!=t[j+i])
				break;
		}
		if(j==len)
			c=1;
	}
	if(c==1)
		printf("Yes");
	else
		printf("No");
	return 0;
}
		

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

int main(){
	string r, a;
	while( cin >> r >> a , r != "0" || a != "0" ){
		int hit = 0, blow = 0;
		for(int i=0 ; i<4 ; ++i){
			if( a[i] == r[i] ) 
				++hit;
			for(int j=0 ; j<4 ; ++j ){
				if( a[i] == r[j] && i != j )
					++blow;
			}
		}
		cout << hit << " " << blow << endl;
	}
}

Measured memory_bytes: 912
X = int(input())

n = 0
balance = 100

while(X-balance > 100):
  
  step = balance // 100
  a = balance % 100
  year = -(-(100 - a) // step)
  n += year
  balance += year * step
  
step = balance // 100
rest = X - balance
n += -(-rest // step)
print(n)




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

#define ll long long

#define fr(i,a,b) for (ll i = (a), _b = (b); i <= _b; i++)
#define frr(i,a,b) for (ll i = (a), _b = (b); i >= _b; i--)
#define rep(i,n) for (ll i = 0, _n = (n); i < _n; i++)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define fill(ar,val) memset(ar, val, sizeof(ar))
#define fill0(ar) fill((ar), 0)
#define debug(x) cout<<#x<<": "<<x<<endl

#define ld long double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

typedef pair<int, int> ii;
typedef pair<ii, int> iii;
typedef vector<ii> vii;
typedef vector<int> vi;

#define INF 1000000000000000000
#define PI 3.14159265358979323846L

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll n;
    cin >> n;

    ll ans = 0;

    fr(i,1,sqrt(n))	
    {
    	if(n%i==0)
    	{
    		ll m = n/i;
    		m--;

    		if(m!=0)
    		{
    			ll x = n/m;
    			ll mod = n%m;
    			if(x==mod)
    				ans = ans + m;
    		}

    		if(i*i!=n)
    		{
    			m = i;
    			m--;
    			if(m!=0)
    			{
    				ll x = n/m;
    				ll mod = n%m;
    				if(x==mod)
    					ans = ans + m;
    			}
    		}
    	}
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
<?php

while (true) {
    fscanf(STDIN, '%d %d %d', $a, $b, $n);
    if (feof(STDIN)) {
        break;
    }
    $s = 0;
    $mod = $a >= $b ? $a % $b : $a;
    for ($i = 0; $i < $n; $i++) {
        $mod *= 10;
        $s += (int) ($mod / $b);
        $mod = $mod >= $b ? $mod % $b : $mod;
    }
    echo $s . PHP_EOL;
}

Measured memory_bytes: 6608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  ll n,y;
  cin >> n >> y;
  y /= 1000;
  rep(i, n + 1){
    for (ll j = 0; i + j <= n;j++){
      if(10*i+5*j+(n-i-j)==y){
        cout << i << " " << j << " " << n - i - j << endl;
        return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;
}


Measured memory_bytes: 3604
#include <iostream>

int main()
{
	int N, K;
	int X[100];
	std::cin >> N;
	std::cin >> K;
	for (int i=0; i<N; i++) std::cin >> X[i];
	int res = 0;
	for (int i=0; i<N; i++) res += 2 * std::min(X[i], K-X[i]);
	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define MOD 1000000007
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int x1,y1,x2,y2,x3,y3,x4,y4,Nr,Dr;
    cin >> x1 >> y1 >> x2 >> y2;
    Nr = y2-y1; Dr = x2-x1;
    x3 = x2-Nr; y3 = y2+Dr;
    x4 = x1-Nr; y4 = y1+Dr;
    cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << "\n";
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <time.h>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
#define RAND (rand()*rand())
#define MAX(x, y) ((x) > (y) ? (x):(y)) 
#define MIN(x, y) ((x) > (y) ? (y):(x))
#define ABS(x) ((x) > 0 ? (x) : -(x))
#define CEIL(x, y) (((x) + (y) - 1)/(y))
using namespace std;
const int MAXN = 1e5 + 5;
const ll MOD = 1e9 + 7;
int N, M, K, Q, T;

int main()
{
	int i, j;
	ll x;
	scanf("%lld", &x);
	printf("%lld", x*x);
}

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

int main()
{
    int N, W;
    int v[110], w[110];

    scanf("%d %d", &N, &W);
    for (int i = 0; i < N; i++)
    {
        scanf("%d %d", &v[i], &w[i]);
    }

    int dp[110][10010];
    for (int i = 0; i <= W; i++)
    {
        dp[0][i] = 0;
    }

    for (int i = 0; i < N; i++)
    {
        for (int j = 0; j <= W; j++)
        {
            if (w[i] <= j)
            {
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }
            else
            {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }

    // for (int i = 0; i <= N; i++)
    // {
    //     for (int j = 0; j <= W; j++)
    //     {
    //         printf("%d, ", dp[i][j]);
    //     }
    //     printf("\n");
    // }

    printf("%d\n", dp[N][W]);

    return 0;
}


Measured memory_bytes: 6704
#include <stdio.h>
#include <vector>
#include <tuple>
#include <algorithm>

int main(void) {
  int n, i;
  std::vector<std::tuple<int, int, int>> v;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    int a, b, c, t;
    scanf("%d%d%d", &a, &b, &c);
    if(a > b) t = a, a = b, b = t;
    if(a > c) t = a, a = c, c = t;
    if(b > c) t = b, b = c, c = t;
    std::tuple<int, int, int> tu = std::make_tuple(a, b, c);
    v.push_back(tu);
  }
  std::sort(v.begin(), v.end());
  v.erase(std::unique(v.begin(), v.end()), v.end());
  std::vector<std::tuple<int, int, int>>::iterator it;
  //for(it = v.begin(); it != v.end(); ++it) printf("%d %d %d\n", std::get<0>(*it), std::get<1>(*it), std::get<2>(*it));
  printf("%d\n", n - v.size());
  return 0;
}


Measured memory_bytes: 2788
#include<bits/stdc++.h>
using namespace std;
long long n,k,ans;
int main(){
	scanf("%lld%lld",&n,&k);
	for(long long i=k+1;i<=n;i++){
		ans+=(n/i)*(i-k);
		if(n%i>=k)ans+=(n%i-k+1);
	}
	if(k==0)ans-=n;
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 3740
/*input
32
3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5
*/

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

const ll MAX_N = 210101;
ll B[MAX_N];
ll C[MAX_N];

int main() {
    ll N, A[MAX_N];
    cin >> N;
    rep(i, N) cin >> A[i];
    rep(i, N) {
        B[i] = -A[i]+i;
        C[i] = A[i]+i;
    }
    // sort(B, B+N);
    sort(C, C+N);
    ll ans = 0;
    rep(i, N) {
        ans += (upper_bound(C, C+N, B[i])-lower_bound(C, C+N, B[i]));
    }
    cout << ans << endl;
}

Measured memory_bytes: 8288
import math

N=int(input())
H=int(input())
W=int(input())
ans_h=0
ans_w=0
for i in range(N):
    if i+H<=N:
        ans_h+=1
for i in range(N):
    if i+W<=N:
        ans_w+=1
print(ans_h*ans_w)


Measured memory_bytes: 3060
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n =sc.nextInt();
		int[] p=new int[n];
		for(int i=0; i<n; i++){
			p[i]=sc.nextInt();
		}
		int count=0;
		for(int i=0; i<n-2; i++){
			if(p[i]>p[i+1]){
				if(p[i+2]<p[i+1]){
					count++;
				}
			}else if(p[i]<p[i+1]){
				if(p[i+2]>p[i+1]){
					count++;
				}
			}else{
				count++;
			}
		}
		System.out.println(count);
	}
}




Measured memory_bytes: 22740
import java.util.*;

public class Main {

	public static void main(String[] args) {
		new Main().execute();
	}

	public void execute() {
		Scanner sc = new Scanner(System.in);
		final int A = sc.nextInt();
		final int B = sc.nextInt();
		final int Q = sc.nextInt();

		long[] shrines = new long[A];
		long[] temples = new long[B];

		for (int i = 0; i < A; i++) {
			shrines[i] = sc.nextLong();
		}

		for (int i = 0; i < B; i++) {
			temples[i] = sc.nextLong();
		}

		for (int q = 0; q < Q; q++) {
			long x = sc.nextLong();

			long r1w = 0;
			int ns = westNearest(shrines, x);
			int nt = nearest(temples, shrines[ns]);
			r1w = Math.abs(x - shrines[ns]) + Math.abs(shrines[ns] - temples[nt]);
			
			long r1e = 0;
			ns = eastNearest(shrines, x);
			nt = nearest(temples, shrines[ns]);
			r1e = Math.abs(x - shrines[ns]) + Math.abs(shrines[ns] - temples[nt]);
			long r1 = Math.min(r1e, r1w);
			
			
			long r2w = 0;
			nt = westNearest(temples, x);
			ns = nearest(shrines, temples[nt]);
			r2w =Math.abs(x - temples[nt]) + Math.abs(temples[nt] - shrines[ns]);

			long r2e =0;
			nt = eastNearest(temples, x);
			ns = nearest(shrines, temples[nt]);
			r2e = Math.abs(x - temples[nt]) + Math.abs(temples[nt] - shrines[ns]);
			
			long r2 = Math.min(r2e, r2w);
			System.out.println(Math.min(r1, r2));
		}
		sc.close();
	}

	private int nearest(long[] loc, long x) {
		int lb = Math.min(loc.length - 1, lowerBound(loc, x));
		if (lb == 0) {
			return lb;
		} else if (Math.abs(loc[lb] - x) > Math.abs(loc[lb - 1] - x)) {
			return lb - 1;
		} else {
			return lb;
		}
	}

	private int westNearest(long[] loc, long x) {
		int lb = Math.min(loc.length - 1, lowerBound(loc, x));
		return lb;
	}

	private int eastNearest(long [] loc, long x) {
		int lb = Math.min(loc.length - 1, lowerBound(loc, x));
		return Math.max(0, lb - 1);
	}

	private int lowerBound(long[] arr, long key) {
		int left = -1;
		int right = arr.length;
		while (right - left > 1) {
			int mid = (left + right) / 2;
			if (arr[mid] < key) {
				left = mid;
			} else {
				right = mid;
			}
		}
		return right;
	}

}

Measured memory_bytes: 98800
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  string S; cin>>S;
  int N=S.size(); 
  int ans=0;
  rep(a,0,(1<<N-1)){
    bitset<9> B(a);
    int sum=0;
    string X;
    X+=S[0];
    rep(i,0,N-1){
      if(B.test(i)){
        sum+=stoll(X);
        X="";
      }
      X+=S[i+1];
    }
    sum+=stoll(X);
    ans+=sum;
  }
  cout<<ans<<endl;
  }




Measured memory_bytes: 768
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){if(x < 2) return 0; for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
ll n,k;
int main(){
 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> k;
	if(n <= k/2) cout << n << endl;
	else{
		if(n % k == 0) cout << 0 << endl;
		else{
			ll t = n / k;
			n -= t * k;
			if(n <= k / 2) cout << n << endl;
			else cout << abs(n - k) << endl;
		}
	}
	return 0;
}
//do smt instead of nothing! never give up!
//take care of long long!
//take care of upper or lower case e.g "yes" or "YES"?
//boundary condition! e.g. n = 0?
//brute force is always the first choice!
// print the ans to look for patterns in the data!

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder.Abc
{
    class QuestionC
    {
        public static void Main(string[] args)
        {
            // 文字列の入力
            //string s = Console.ReadLine();

            // 整数の入力
            long n = long.Parse(Console.ReadLine());

            // 文字列配列の入力
            //string[] inputStrArray = Console.ReadLine().Split(' ');

            // 整数配列の入力
            var inputLongArray = Console.ReadLine().Split(' ').Select(i => long.Parse(i)).ToArray();

            double result = int.MaxValue;

            for (int i = -100; i <= 100; i++)
            {
                double ans = 0;
                for (int j = 0; j <= n - 1; j++)
                {
                    ans += Math.Pow(inputLongArray[j] - i, 2);
                }

                result = Math.Min(result, ans);

            }

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 13396
#include <cstdio>

#define min(a,b) ((a) > (b) ? (b) : (a))
#define INF 10000
int num[51][51],H,W;

int main(){
	for(int i = 0; i < 51; i++){
		for(int j = 0; j < 51; j++){
			num[i][j] = INF;
		}
	}
	num[1][0] = 0;
	scanf("%d%d",&H,&W);
	char c;
	for(int i = 1; i <= H;i++){
		for(int j = 1; j <= W;j++){
			scanf("\n%c",&c);
			num[i][j] = (int)(c-'0') + min(num[i][j-1],num[i-1][j]);
		}
	}
	printf("%d\n",num[H][W]);

	return 0;
}

Measured memory_bytes: 2712
N = input()

v = map(int, raw_input().split(' '))

found = 0

i = 0
while i < N:
	j = i
	while j < N - 1 and v[i] == v[j + 1]:
		j += 1

	found += (j - i + 1) / 2

	i = j + 1

print found

Measured memory_bytes: 2568
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
struct Item {
	int v, w;
	Item() :v(0), w(0) {}
	Item(int v, int w) :v(v), w(w) {}
	Item &operator+=(const Item &p) {
		v += p.v;
		w += p.w;
		return *this;
	}
	Item operator+(const Item &p) {
		*this += p;
		return *this;
	}
	bool operator<(const Item &p)const {
		return (w == p.w) ? (v < p.v) : (w < p.w);
	}
	bool operator>(const Item &p)const {
		return (w == p.w) ? (v > p.v) : (w > p.w);
	}
};
istream &operator >> (istream &is, Item &p) {
	is >> p.v >> p.w;
	return is;
}
ostream &operator<<(ostream &os, Item &p) {
	os << p.v << " " << p.w;
	return os;
}
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, W; cin >> N >> W;
	vector<Item>items(N);
	rep(i, 0, N)cin >> items[i];
	vector<Item>a, b;
	int n1 = N / 2, n2 = N - n1;
	rep(i, 0, 1 << n1) {
		Item x;
		rep(j, 0, n1)if (i & (1 << j))x += items[j];
		a.push_back(x);
	}
	rep(i, 0, 1 << n2) {
		Item x;
		rep(j, 0, n2)if (i & (1 << j))x += items[n1 + j];
		b.push_back(x);
	}
	sort(all(b));
	//rep(i, 0, b.size())cout << b[i] << ",";
	int m(1);
	rep(i, 1, b.size()) {
		if (b[m - 1].v < b[i].v)b[m++] = b[i];
	}
	//rep(i, 1, b.size())chmax(b[i], b[i - 1]);
	
	int ans(0);
	rep(i, 0, a.size()) {
		if (a[i].w > W)continue;
		//chmax(ans, a[i].v + (upper_bound(all(b), Item(INF, W - a[i].w))-1)->v);
		int l(0), r(m);
		while (r - l > 1) {
			int mid = (l + r) / 2;
			if (b[mid].w + a[i].w <= W)l = mid;
			else r = mid;
		}
		chmax(ans, b[l].v + a[i].v);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 43652
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
ll mod_pow(ll, ll, ll);
ll mod_fact(ll, ll);
ll mod_inv(ll, ll);
//
int main(){
    string s;
    cin >> s;
    int len = s.length();
    ll num = 0;
    ll base = 1;
    int rem[len + 1];
    for(int i = len - 1; i >= 0; i--){
        num = (num + (s[i] - '0') * base) % 2019;
        rem[i] = num;
        base = base * 10 % 2019;
    }
    rem[len] = 0;
    sort(rem, rem + len + 1);
    ll ans = 0;
    ll cur = -1;
    ll cnt = 0;
    for(int i = 0; i <= len; i++){
        if(cur == rem[i]){
            cnt++;
        }else{
            ans += (cnt * (cnt - 1)) / 2;
            cur = rem[i];
            cnt = 1;
        }
    }
    ans += (cnt * (cnt- 1)) / 2;
    cout << ans << endl;
}

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

const ll INF=100000;

int main(){
  ll a,b,c,k;
  cin  >> a >>b >>k;
  ll count=0;
  ll res[110]={0};
  for(int i=1;i<110;i++){
    if(a%i==0&&b%i==0){
      res[count]=i;
      count++;
    }
  }
  cout << res[count-k] << endl;
}


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

using namespace std;

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

ll mod = 1e9 + 7;

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

	cout << n*n*n << endl;

	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Yulian
 */

#include <iostream>
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>


#include <iostream>

#include <fstream>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <string>
#include <algorithm>
#include <map>
//#include "../../library/lib.hpp"


using namespace std;
class TaskB {
public:
	void solve(std::istream& in, std::ostream& out) {
    ios::sync_with_stdio(false);
		int n, m;
		in >> n >> m;
		vector<string> a (n), b(m);
		for(int i = 0; i < n; ++i){
			in >> a[i];
		}
		for(int i = 0; i < m; ++i){
			in >> b[i];
		}
		bool fit = true;
		for(int i = 0; i <= n-m; ++i){
			for(int j = 0; j <= n - m; ++j){
				fit = true;
				// test current offset
				for(int k = 0; k < m; ++k){
					for(int l = 0; l < m; ++l){
						if(a[k+i][l+j] != b[k][l]){
							fit = false;
						}
					}
				}
				if(fit){
					out << "Yes" << endl;
					return;
				}
			}
		}
		out << "No" << endl;
	}
};


int main() {
	TaskB solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    string s;
    cin>>s;
    int n=s.size();
    int ans=0;
    int cnt0=0,cnt1=0;
    rep(i,n){
        if(s[i]=='0')++cnt0;
        else ++cnt1;
    }
    cout<<2*min(cnt1,cnt0)<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
#define l long long
#define pb push_back
#define find(v,n) find(v.begin(),v.end(),n)
void frooty()
{
	l n;
	cin>>n;
	l a[n+1]={0};
	//memset(a,0,sizeof(a));
	for(l i=0;i<n-1;i++)
	{
		l x;
		cin>>x;
		a[x]++;
	}
	for(l i=1;i<=n;i++)
	{
		cout<<a[i]<<"\n";
	}
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	l t=1;
	//cin>>t;
	while(t--)
	{
		frooty();
	}
}
		

Measured memory_bytes: 5264
#coding:utf-8
n = int(input())
m = [[0 for i in range(n)] for j in range(n)]
p = []
for i in range(n):
    p1,p2 = map(int,input().split())
    if i == 0:
        p.append(p1)
    p.append(p2)

def matrixChainMultiplication():
    for i in range(n):
        m[i][i] = 0

    for l in range(2,n+1):
        for i in range(0,n-l+1):
            j = i + l - 1
            m[i][j] = 1000000
            for k in range(i,j):
                m[i][j] = min(m[i][j], m[i][k] + m[k+1][j] + p[i] * p[k+1] * p[j+1])
matrixChainMultiplication()
print(m[0][n-1])



Measured memory_bytes: 5688
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;

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

    vector<lint> x(n);
    for(auto& elem : x)  cin >> elem;

    auto f = [&](lint p) {
        lint res = 0;
        for(lint i=0; i<n; i++) {
            res += (x[i] - p) * (x[i] - p);
        }
        return res;
    };

    lint ans = 1e18;
    for(lint i=0; i<=100; i++) {
        ans = min(ans, f(i));
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii=pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define fore(x,c) for(auto &&x:c)
#define rep(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define rrep(i, a, n) for(int i=(int)(n-1);i>=a;--i)
#define sz(c) ((int)c.size())
#define contains(c,x) (c.find(x)!=end(c))
#define inseg(l,x,r) ((l)<=(x)&&(x)<(r))
#define dump(...)
#define pb push_back
#define _ 0
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        cin.tie(nullptr); ios::sync_with_stdio(0);
        cout << setprecision(15) << fixed;
        // #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int N;
    cin >> N;
    vector<pii> A(N);
    rep(i, 0, N) {
        int a;
        cin >> a;
        A[i] = {a, i};
    }
    sort(all(A));

    vi ans;
    rep(i, 0, N) {
        ans.pb(A[i].second + 1);
    }
    cout << ans << endl;
    return (0^_^0);
}



Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const ll MOD=1000000007;
ll N,C,K;
ll T[100000];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>N>>C>>K;
    rep(i,0,N) cin>>T[i];
    sort(T,T+N);
    ll ans=0;
    ll i=0;
    while(i<N){
        ans++;
        ll res=1;
        ll t=T[i];
        while(i<N&&res<=C&&T[i]<=t+K){
            i++;
            res++;
        }
    }
    cout <<ans<<"\n";
}

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

using namespace std;

typedef long long ll;
const ll INFTY=1ll<<61;

template<typename T>
void chmin(T& a,const T& b)
{
	a=min(a,b);
}

int main()
{
	for(int n,m,l;cin>>n>>m>>l;){
		vector<int> ks(n),ss(m);
		for(int& k:ks) cin>>k,k--;
		for(int& s:ss) cin>>s;
		
		sort(begin(ks),end(ks));
		
		vector<ll> sum(m+1);
		for(int i=0;i<m;i++) sum[i+1]=sum[i]+ss[i];
		
		vector<vector<ll>> dp(n,vector<ll>(n,INFTY));
		dp[0][0]=0;
		for(int i=1;i<n-1;i++) for(int j=0;j<i;j++){
			chmin(dp[i][j],dp[i-1][j]+(sum[ks[i]+1]-sum[ks[i-1]])/l);
			chmin(dp[i][i-1],dp[i-1][j]+(sum[ks[i]+1]-sum[ks[j]])/l);
		}
		ll res=INFTY;
		for(int i=0;i<n-1;i++)
			chmin(res,dp[n-2][i]+(sum[ks[n-1]+1]-sum[ks[n-2]])/l+(sum[ks[n-1]+1]-sum[ks[i]])/l);
		cout<<res<<endl;
	}
}

Measured memory_bytes: 33468
#include <stdio.h>
#include <string.h>


int main(){
  int r,d,x;
  scanf("%d",&r);
  scanf("%d",&d);
  scanf("%d",&x);

  int i;
  for(i = 0;i<10;i++){
    x = x * r - d;
    printf("%d\n",x);
  }


}


Measured memory_bytes: 128
from math import ceil

x,k,d = map(int,input().split())
x = abs(x)
steps = ceil(x/d)
if k <= steps:
  x = x-d*k
  print(abs(x))
else:
  k -= steps
  x = x-d*steps
  if k&1:
    print(abs(x+d))
  else:
    print(abs(x))

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

using ll = long long;
using vi = vector<int>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using pii = pair<int,int>;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back

ll modpow(ll m,ll n,ll p) {
  if(n==0) return 1;
  ll res=modpow(m,n/2,p);
  if(n%2==0) res=(res*res)%p;
  else res=(((res*res)%p)*m)%p;
  return res;
}

int main() {
  ll ans=-1;
  ll k; cin>>k;

  for(ll n=1;n<=3*k;n++) {
    if(7*(modpow(10,n,9*k)-1)%(9*k)==0) {
      ans=n;
      break;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int flag = 0;
		String s = sc.next();

		for(int i=0;i<a;i++) {
			if(s.substring(i,i+1).equals("-")) {
				flag = 1;
			}
		}
		if(!s.substring(a,a+1).equals("-")) {
			flag = 1;
		}
		for(int i=a+1;i<a+b+1;i++) {
			if(s.substring(i,i+1).equals("-")) {
				flag = 1;
			}
		}
		if(flag == 1) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}

	}

	public static int res(int n) {
		if(n==1) {
			return 1;
		}

		return n+res(n-1);
	}
}




Measured memory_bytes: 21844