akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

///////////////////////////////////////////////////////////////////////////


int main(){

    int n,d;
    cin >> n >> d;
    int x[n][d] = {};
    rep(i,0,n){
	rep(j,0,d)cin >> x[i][j];
    }
    
    int ans = 0;

    rep(i,0,n){
	rep(j,i+1,n){
	    double t = 0;
	    rep(k,0,d)t += (x[i][k] - x[j][k])* (x[i][k] - x[j][k]);
	    t = sqrt(t);
	    if((double)((int)t) == t)ans++;
	}
    }
    
    P(ans);
    return  0;
}


Measured memory_bytes: 256
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    cout << s.substr(0,3) << endl;
}

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

typedef long long ll;

#define v(T) vector<T>
#define ttt(T) tuple<T, T, T>
#define pb push_back
#define mp make_pair
#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 poiu(n) for(int i=0; i < n; i++)
#define MOD (int)10e9+7
#define endl '\n'

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

using namespace std;

int n;
int temp_one, temp_two;

pair<int, int> endpoints[100000];



int main() {
    
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    cin >> n;
    for(int i=0;i<n;i++) {
        cin >> temp_one >> temp_two;
        endpoints[i].first=(temp_one-temp_two);
        endpoints[i].second=(temp_one+temp_two);
    }
    
    sort(endpoints, endpoints+n, [](pair<int, int> x, pair<int, int> y) {if(x.second==y.second){return x.first<y.first;}return x.second < y.second;});

    pair<int,int> prev = endpoints[0];
    int curr_max=1;
    for(int i = 1; i < n; i++) {
        if(endpoints[i].first>=prev.second)
            curr_max++, prev=endpoints[i];
    }

    cout << curr_max << endl;
        

    
    return 0;

}



Measured memory_bytes: 1024
#include<iostream>

using namespace std;

unsigned int xor128(){
	static unsigned int x=123456789,y=362436069,z=521288629,w=88675123; 
	unsigned int t=(x^(x<<11));
	x=y;y=z;z=w;
	return w=(w^(w>>19))^(t^(t>>8));
}

template<class Key,class Val>
class Treap{
	struct Node{
		unsigned int priority;
		Key key;
		Val value;
		Node *left,*right;
		int size;
		Node(const Key& k,const Val& v)
			:priority(xor128()),key(k),value(v),left(0),right(0),size(1){}
		~Node(){
			if(left)delete left;
			if(right)delete right;
		}
		Node *rotate_right(){
			Node *s=left;
			left=s->right;
			s->right=this;
			return s;
		}
		Node *rotate_left(){
			Node *s=right;
			right=s->left;
			s->left=this;
			return s;
		}
		Node *merge(Node *t){
			if(!this)return t;
			if(!t)return this;
			Node *s=this;
			if(t->key < key){
				left = left->merge(t);
				if(priority < left->priority)s=rotate_right();
			}else if(key < t->key){
				right = right->merge(t);
				if(priority < right->priority)s=rotate_left();
			}else return this;
			s->update();
			return s;
		}
		Node *find(const Key& k){
			return !this?NULL:k==key?
				this:k<key?left->find(k):right->find(k);
		}
		Node *erase(const Key& k){
			if(!this)return NULL;
			Node *s=this;
			if(k==key){
				if(!left&&!right){
					delete this;
					return NULL;
				}
				if(left && (!right || left->priority > right->priority)){
					s=rotate_right();
					s->right=s->right->erase(k);
				}else{
					s=rotate_left();
					s->left=s->left->erase(k);
				}
			}
			else if(k<key)left = left->erase(k);
			else right = right->erase(k);
			s->update();
			return s;
		}
		Node *nth_element(int n){
			if(size<=n)return NULL;
			Node *t=this;
			while((t->left?t->left->size:0)!=n){
				if(t->left && n<=t->left->size){
					t=t->left;
				}else {
					if(t->left)n-=t->left->size;
					n--;
					t=t->right;
				}
			}
			return t;
		}
		void update(){
			left->update_size();
			right->update_size();
			update_size();
		}
		void update_size(){
			if(!this)return;
			size = 1 + (left?left->size:0) + (right?right->size:0);
		}
	} *root;
public:
	Treap():root(0){}
	~Treap(){if(root)delete root;}
	void insert(const Key& k,const Val& v){
		root=root->merge(new Node(k,v));
	}
	void merge(Treap<Key,Val> *t){
		root=root->merge(t->root);
		t->root=0;
	}
	Val* find(const Key& k){
		Node *p=root->find(k);
		if(p)return &p->value;
		return NULL;
	}

	void erase(const Key& k){
		root=root->erase(k);
	}
	Key nth_element(int n){
		return root->nth_element(n)->key;
	}
	int size()const{
		return root->size;
	}
};

class Nothing{};

int main(){
	int n,k,m;
	while(cin>>n>>k>>m,n|k|m){
		Treap<int,Nothing> t;
		for(int i=1;i<=n;i++)t.insert(i,Nothing());
		m--;
		while(1<t.size()){
			t.erase(t.nth_element(m));
			m=(m+k-1)%t.size();
		}
		cout<<t.nth_element(0)<<endl;
	}
	return 0;
}

Measured memory_bytes: 1668
n,m=map(int,input().split())
S=[]
for i in range(m):
    s=list(map(int,input().split()))
    S.append(s[1:])
P=tuple(map(int,input().split()))

switch = []
for i in range(2**n):
    x = bin(i)
    switch.append(['0']*(n+2-len(x))+list(x)[2:])
    
ans = 0

for i in switch: #各スイッチパターン
    ite = 0
    for j in S: #各電球
        count = 0
        for k in j:
            count += int(i[k-1])
        if count%2 != P[ite]:
            break
        else:
            ite += 1
    if ite == len(S):
        ans += 1

print(ans)

Measured memory_bytes: 40688
#define _GLIBCXX_DEBUG
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, K, sum=0;
  cin >> N >> K;
  int l[N];
  
  for(int i=0; i<N; i++) cin >> l[i];
  
  sort(l, l + SIZE_OF_ARRAY(l), greater<>());
  
  for(int i=0; i<K; i++){
    sum += l[i];
  }

  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 3640
class UnionTree:

	# 節の数
	def __init__(self, N):
		self.__par = [i for i in range(N)]
		self.__rank = [0] * N

	# 根
	def root(self, x):
		if(self.__par[x] == x):
			return x
		else:
			self.__par[x] = self.root(self.__par[x])
			return self.__par[x]

	# 結合
	def unite(self, x, y):
		rx = self.root(x)
		ry = self.root(y)
		if(rx == ry):
			return

		if(self.__rank[rx] < self.__rank[ry]):
			self.__par[rx] = ry
		else:
			self.__par[ry] = rx
			if(self.__rank[rx] == self.__rank[ry]):
				self.__rank[rx] += 1

	# 一致
	def same(self, x, y):
		rx = self.root(x)
		ry = self.root(y)
		if(rx == ry):
			return True
		
		
# N枚のカードとルール
N, M = map(int, input().split())

# UnionTree Class
union_tree = UnionTree(N)

# ルールの適応
for i in range(M):
	# 結合
	a, b, x = map(int, input().split())
	union_tree.unite(a-1, b-1)

# 個数のみ数える
cnt = set()

for i in range(N):
	cnt.add(union_tree.root(i))

print(len(cnt))

Measured memory_bytes: 16784
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;

int R, S, P;
int point(char c) {
    if (c == 'r') return P;
    else if (c == 's') return R;
    return S;
}

int index(char c) {
    if (c == 'r') return 0;
    else if (c == 's') return 1;
    return 2;
}
int main()
{
    int N, K;
    cin >> N >> K >> R >> S >> P;
    string T;
    cin >> T;
    vector<int> able(N);

    ll ans = 0;
    rep(i, N) {
        if (i - K >= 0) {
            if (T[i] != T[i - K]) {
                ans += point(T[i]);
                able[i] = 1;
            }
            else if (able[i - K] == 0) {
                ans += point(T[i]);
                able[i] = 1;
            }
        }
        else {
            ans += point(T[i]);
            able[i] = 1;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3852
use std::env;
use std::io::*;
use std::str::*;
use std::mem;
use std::collections::HashMap;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let s = stdin.bytes().map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect::<String>();
    s.parse::<T>().ok().unwrap()
}
fn read_char() -> char {
    let c = read::<String>();
    let c = c.chars().collect::<Vec<char>>();
    c[0]
}
fn read_String_Vec() -> Vec<char> {
    let S = read::<String>();
    S.chars().collect::<Vec<char>>()
}

fn vecchar_to_String(Vs: Vec<char>) -> String {
    let mut S = String::new();
    for i in 0..Vs.len() {
        S.push(Vs[i]);
    }
    S
}

/*
A : 65
Z : 90
a : 97
z : 122
*/

/*
let N = read::<i32>();
let S = read::<String>();
let S = read_String_Vec();
let C = read_char();
*/

/*
 .to_string() : * -> String
 &*S          : String -> &str
*/

fn main() {
    // main の引数
    /*
        引数なしのときargs.len() = 1;
    */
    let args: Vec<String> = env::args().collect();

    let N = read::<i32>();
    let K = read::<i32>();
    let mut sum = 0;
    for i in 0..N {
        let x = read::<i32>();
        if x < K-x {
            sum += x;
        } else {
            sum += K-x;
        }
    }

    println!("{}", sum*2);
}


Measured memory_bytes: 4352
import std;

alias Edge = Tuple!(int, "node", int, "coin", int, "time");
alias Exchange = Tuple!(int, "coin", int, "time");

alias T = Tuple!(int, "node", long, "coin", long, "time");
alias MinHeap = BinaryHeap!(Array!T, (a, b) => a.time > b.time);

alias UsedKey = Tuple!(int, "node", long, "coin");

void calc(int n, int s, Edge[][] adj, Exchange[] exchanges) {
    auto q = new MinHeap();
    q.insert(T(0, s, 0));

    int[UsedKey] used;

    auto ans = new long[n];
    ans[] = long.max;
    while (!q.empty) {
        auto t = q.front; q.popFront();

        if (used[UsedKey(t.node, t.coin)]++) continue;
        ans[t.node] = min(ans[t.node], t.time);

        // visited all
        if (ans.all!(e => e < long.max)) break;

        foreach (edge; adj[t.node]) {
            if (t.coin >= edge.coin) {
                q.insert(T(edge.node, t.coin - edge.coin, t.time + edge.time));
            }
        }

        // 全てのノードを回るのに必要な銀貨の枚数は、全ノード数(50) * 銀貨MAX(50) = 2500
        if (t.coin < 2500) {
            // 金貨と銀貨を交換
            q.insert(T(t.node, t.coin + exchanges[t.node].coin, t.time + exchanges[t.node].time));
        }
    }

    foreach (e; ans[1..$]) writeln(e);
}

void main() {
    int n, m, s; scan(n, m, s);
    Edge[][] adj;
    foreach (_; 0..n) adj ~= [[]];
    foreach (_; 0..m) {
        int u, v, a, b; scan(u, v, a, b);
        u--;
        v--;
        adj[u] ~= Edge(v, a, b);
        adj[v] ~= Edge(u, a, b);
    }
    Exchange[] exchanges;
    foreach (_; 0..n) {
        int c, d; scan(c, d);
        exchanges ~= Exchange(c, d);
    }

    calc(n, s, adj, exchanges);
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


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

long long nibutan(vector<long long>& in, long long comp)
{
    if(in[0] >= comp){
        return -1;
    }
    long long ok = 0;
    long long ng = in.size();
    while(ng - ok != 1){
        long long mid = (ok + ng) / 2;
        if(in[mid] < comp){
            ok = mid;
        } else {
            ng = mid;
        }
    }
    return ok;
}

int main()
{
    int n;
    vector<long long> a;
    vector<long long> b;
    vector<long long> c;
    cin >> n;
    for(int i = 0; i < n;  i++){
        int in;
        cin >> in;
        a.push_back(in);
    }
    for(int i = 0; i < n;  i++){
        int in;
        cin >> in;
        b.push_back(in);
    }
    for(int i = 0; i < n;  i++){
        int in;
        cin >> in;
        c.push_back(in);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());
    long long capacityB[100010];
    for(int i = 0; i < n; i++){
        capacityB[i] = nibutan(a, b[i]) + 1;
    }
    long long capacitySumB[100010];
    capacitySumB[0] = capacityB[0];
    for(int i = 1; i < n; i++){
        capacitySumB[i] = capacitySumB[i - 1] + capacityB[i];
    }
    long long capacityC[100010];
    for(int i = 0; i < n; i++){
        int l = nibutan(b, c[i]);
        if(l == -1){
            capacityC[i] = 0;
        } else {
            capacityC[i] = capacitySumB[l];
        }
    }
    long long answer = 0;
    for(int i = 0; i < n; i++){
        answer += capacityC[i];
    }
    cout << answer << endl;
    return 0;
}


Measured memory_bytes: 5364
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<pair<int, int> > VPII;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define INF 999999999999999997;
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
int dxx[8] = { 0,1,1,1,0,-1,-1,-1 };
int dyy[8] = { 1,1,0,-1,-1,-1,0,1 };

// vector注意
// vec[i][j]の形に入力を入れるとき、vecは初期化してある必要がある.

// ------------------- include, typedef, define END. -------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL H, W;
	cin >> H >> W;
	string s;
	FOR(i, 0, H) {
		FOR(j, 0, W) {
			cin >> s;
			if (s == "snuke") {
				char out = ('A' + j);
				cout << out << i + 1 << endl;
			}
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 100000

int main(){
  int Bnum, Tmax, Tnum = 1;
  int Bwei[N], Twei = 0;
  int Tminwei = 0;
  int i;
  
  scanf("%d%d",&Bnum, &Tmax);

  for(i = 0; i < Bnum; i++){
    scanf("%d", &Bwei[i]);
    Tminwei += Bwei[i];
    /*
    if(Bwei[i] > Tminwei){
      Tminwei = Bwei[i];
    }
    */
  }

  Tminwei = Tminwei/Tmax;
  
  // printf("start %d\n", Tminwei);
  i = 0;
  
  while(i != Bnum){
    
    Twei += Bwei[i];
    i++;
    
    if(Twei > Tminwei){
      Tnum++;
      Twei = 0;
      i--;
    }
    
    if(Tnum > Tmax){
      Tminwei++;
      Tnum = 1;
      i = 0;
    }    
    // printf("i:%d  Twei:%d Tnum:%d\n",i, Twei, Tnum);
  }

  printf("%d\n", Tminwei);
  
  return 0;
}



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

int gcd(int a,int b){return (!b)?(a):(gcd(b,a%b));}
int abs(int k){return (k>0)?(k):(-k);}

int n,m,x;
int ans;

int main(){
	scanf("%d%d",&n,&m);
	scanf("%d",&x);
	ans=abs(m-x);
	for (int i=2;i<=n;i++){
		scanf("%d",&x);
		ans=gcd(ans,abs(m-x));
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
from itertools import accumulate

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

C = [0]*(max(A)+1)
B = [0]*N

for a in A:
    C[a] += 1

C = list(accumulate(C))

for a in A[::-1]:  
    C[a] -= 1
    B[C[a]] = a

print(*B)


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


int x[26];
int main() {
    //ios_base::sync_with_stdio(false);
    //cout<<setprecision(17);
    string g="zyxwvutsrqponmlkjihgfedcba";
    string s;
    cin>>s;
    if(s>=g){
        cout<<"-1";
    }
    else{
        for(int i=0;i<s.size();i++){
           int k=s[i]-'a';
           x[k]++;
        }
        bool g1=1;
        bool g2=0;
        int i0;
        for(int i=0;i<26;i++){
                if(x[25-i]==2){
                   g1=0;
                }
                if(x[25-i]==0){
                    i0=25-i;
                    g2=1;
                }
        }
        if(g1==1&&g2==1){
            char p=i0+'a';
            cout<<s<<p;
            return 0;
        }

        int k;
        for (k=s.size()-1;k>-1;k--){
            g1=1;
            g2=0;
            for(int i=0;i<26;i++){
                if(x[25-i]==2){
                    g1=0;
                }
                if(x[25-i]==0&&s[k]<'a'+(25-i)){
                    g2=1;
                    i0=25-i;
                }
            }
            if(g1==1&&g2==1){
                for(int i=0;i<k;i++){
                    cout<<s[i];
                }
                char p='a'+i0;
                cout<<p;
                return 0;
            }
            int f=s[k]-'a';
            x[f]--;
        }

    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
    int n,ans;
    int a[4][100005]={},f[4][100005]={};
int main()
{
    cin >> n;
    for (int i=1;i<=n;i++)  scanf("%d%d%d",&a[1][i],&a[2][i],&a[3][i]);
    for (int i=1;i<=3;i++) f[i][1]=a[i][1];
    for (int i=2;i<=n;i++)
    {
        f[1][i]=max(f[2][i-1],f[3][i-1])+a[1][i];
        f[2][i]=max(f[1][i-1],f[3][i-1])+a[2][i];
        f[3][i]=max(f[1][i-1],f[2][i-1])+a[3][i];
    }
    ans=0;
    for (int i=1;i<=3;i++) if (f[i][n]>ans) ans=f[i][n];
    cout << ans << endl;
}


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

int main(){
    int N,M,C;  cin>>N>>M>>C;
    int B[M];   for(int i=0;i<M;i++)cin>>B[i];

    int ans=0;

    for(int i=0;i<N;i++){
        int sum=0;
        for(int j=0;j<M;j++){
            int A;  cin>>A;

            sum+=A*B[j];

        }
        if(sum + C>0)ans++;
    }

    cout<<ans<<endl;




    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
//#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 10000000000000000;
const int mod = 1000000007;
int test[12345678], kari[345678], aa[12345678];
signed main() {
	int n, k, a, b, ans = 1; cin >> n >> k;
	vector<vector<int> > G(123456);
	for (int h = 1; h < n; h++) {
		cin >> a >> b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	queue<int> que; queue<int> mae; ans *= k;
	for (int i = 0; i < G[1].size(); i++) {
		que.push(G[1][i]); mae.push(1);
		test[1]++; ans *= (k - test[1]); ans %= mod;
	}
	while (que.size()) {
		for (int i = 0; i < G[que.front()].size(); i++) {
			if (G[que.front()][i] != mae.front()) {
				que.push(G[que.front()][i]); mae.push(que.front());
				test[que.front()]++; ans *= (k - test[que.front()] - 1); ans %= mod;
			}
		}
		que.pop(); mae.pop();
	}
	cout << ans % mod << endl;
	cin >> n; return 0;
}

Measured memory_bytes: 10740
#pragma region Macros
#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using WGraph = vector<vector<pair<int, ll>>>;

template<class T>inline bool chmax(T &a, const T &b) { if (b > a) { a = b; return true; } return false; }
template<class T>inline bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; }

constexpr int dx[4] = {-1, 0, 0, 1}, dy[4] = {0, -1, 1, 0};
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
constexpr long long LINF = 1e18;
constexpr double EPS = 1e-10;
constexpr double PI = M_PI;
#pragma endregion

void solve() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i=0; i<n; i++) {
        cin >> a.at(i);
    }

    vector<vector<ll>> dp(n, vector<ll>(k+1));
    for (int i=0; i<=a.at(0); i++) {
        dp.at(0).at(i) = 1;
    }
    for (int i=1; i<n; i++) {
        ll tmp = 0;
        for (int j=0; j<=k; j++) {
            tmp += dp.at(i-1).at(j);
            if (j > a.at(i)) tmp -= dp.at(i-1).at(j-a.at(i)-1);
            tmp %= MOD;
            if (tmp < 0) tmp += MOD;
            dp.at(i).at(j) = tmp;
        }
    }

    cout << dp.at(n-1).at(k) << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}


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

using namespace std;

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")

#define fastio               \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
//#define int long long
#define ll long long
#define ld long double
#define endl "\n"
#define inf ULLONG_MAX
#define gcd __gcd
#define deb(x) cout << #x << " " << x << endl;
#define pr(x) cout << x << endl;

#define sz(a) ((ll)(a).size())
#define len(a) a.length()
#define all(v) (v).begin(), (v).end()
#define tr(c) for (auto(it) = (c).begin(); (it) != (c).end(); it++)
#define pres(c, val) ((c).find(val) != (c).end())
#define cpres(c, val) (find(all(c), val) != (c).end())
#define dec greater<ll>()
#define sortv(x) sort(all(x))
#define revsortv(x) sort(all(x), dec)
#define com(x) ((x) * (x + 1) / 2)

#define maxv(a) *max_element(all(a))
#define minv(a) *min_element(all(a))
#define pb push_back
#define ins insert
#define mp make_pair
#define ff first
#define ss second
#define bg begin()
#define ed end()
#define bs binary_search // to find if an element is present or not in Ologn time, return a boolean
#define ub upper_bound   // to find an element strictly greater than the given no.
#define lb lower_bound   // lb(v,begin(), v.end(), n) gives the iterator

#define fo(n) for (ll i = 0; i < n; i++)
#define fo1(n) for (ll i = 1; i < n; i++)
#define fo2(i, n) for (ll i = 0; i < n; i++)
#define fo3(i, a, b) for (ll i = a; i < b; i++)
#define fors(a) cin >> a[i]
#define forp(a) cout << a[i] << " "
#define prv(a)         \
    fo(sz(a)) forp(a); \
    cout << endl;
#define fob(i, a, b) for (ll i = (b); i >= (a); i--)

typedef pair<ll, ll> pll;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<pll> vpl;
typedef set<ll> sl;
typedef set<char> sc;
typedef map<string, ll> msl;
typedef unordered_map<string, ll> umsl;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;

#define scan(v, n)   \
    vl v;            \
    fo(n)            \
    {                \
        ll item;     \
        cin >> item; \
        v.pb(item);  \
    }

const ll INF = 0xFFFFFFFFFFFFFFFL;
const ll N = 1e9 + 7;

void solve()
{
    ll n; 
    cin >> n;
    ll cnt = 0;
    ll x = 100;  

    while(x < n)
    {
        x *= 1.01; 
        cnt++; 
    } 
    pr(cnt);
}

int32_t main(int32_t argc, char **argv)
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    /*#ifndef ONLINE_JUDGE
    freopen("inputf.txt", "r", stdin);
    freopen("outputf.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif*/

    ll t;
    //cin >> t;
    t=1;
    while (t--)
        solve();

    cerr << endl
         << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

    return 0;
}


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

using namespace std;
const int mx = 1e5+10;

int tab[mx], dp[mx];
set <int> s;
int main(){
   int n, k;
   scanf("%d %d",&n, &k);

   for(int i=1; i<=n; i++){
      scanf("%d",&tab[i]);
      dp[i] = 1e9;
   }
   dp[1]=0;
   for(int i=2; i<=n; i++){
      for(int j=1; j<=k; j++)
         dp[i] = min(dp[max(i-j, 1)]+abs(tab[max(i-j, 1)]-tab[i]), dp[i]);
      //printf("%d\n",dp[i]);
   }

   printf("%d\n",dp[n]);
   return 0;
}


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

int main(){
  int n; cin>>n;
  ll sum=0;
  vector<ll> num(n);
  for(int i=0;i<n;i++){
    ll a,b; cin>>a>>b;
    num[i]=a+b;
    sum+=b;
  }
  sort(num.rbegin(),num.rend());
  ll ans=0;
  for(int i=0;i<n;i+=2){
    ans+=num[i];
  }
  cout<<ans-sum<<endl;
}

Measured memory_bytes: 1024
import numpy as np

N = int(input())
S = np.fromiter('-'+input(),dtype='U1')
Q = int(input())
query = map(int,input().split())

isD = S == 'D'
isM = S == 'M'
isC = S == 'C'

cumD = isD.cumsum(dtype=np.int64)
cumM = isM.cumsum(dtype=np.int64)

for K in query:
    x = cumD.copy(); x[K:] -= cumD[:-K]
    x *= isM
    x[K+1:] -= isD[1:-K] * (cumM[K:-1] - cumM[:-K-1])
    print((x.cumsum() * isC).sum())


Measured memory_bytes: 58844
from heapq import heappush, heappop

INF = 10 ** 20

while True:
  n = int(input())
  if n == 0:break

  buil_point = [None] * n
  for _ in range(n):
    b, x, y = map(int, input().split())
    buil_point[b - 1] = (x, y)
  
  edges = [[] for _ in range(n)]
  for i in range(n):
    for j in range(i + 1, n):
      ix, iy = buil_point[i]
      jx, jy = buil_point[j]
      cost = ((jx - ix) ** 2 + (jy - iy) ** 2) ** (1 / 2)
      if cost <= 50:
        edges[i].append((cost, j))
        edges[j].append((cost, i))

  m = int(input())
  for _ in range(m):
    s, g = map(int, input().split())
    costs = [INF] * n
    costs[s - 1] = 0
    paths = [[]] * n
    paths[s - 1] = [s - 1]
    que = []
    heappush(que, (0, [s - 1]))
    while que:
      dist, path = heappop(que)
      last = path[-1]
      for cost, to in edges[last]:
        if costs[to] > dist + cost:
          costs[to] = dist + cost
          paths[to] = path + [to]
          heappush(que, (dist + cost, path + [to]))
    
    if paths[g - 1]:
      print(*list(map(lambda x:x + 1, paths[g - 1])))
    else:
      print("NA")


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

int Getinfo(int idx) {
  cout << idx << endl;
  string s;
  cin >> s;
  if (s == "Vacant")
    exit(0);
  else if (s == "Male")
    return 1;
  else
    return 0;
}

int main() {
  int n;
  cin >> n;
  auto buf = vector<int>(n, 0);
  buf[0] = Getinfo(0);
  buf[n - 1] = Getinfo(n - 1);
  int left = 0, right = n - 1;
  // 解の存在範囲は[left, right]
  while (true) {
    int mid = (left + right) / 2;
    buf[mid] = Getinfo(mid);
    if (abs(mid - left) % 2 != abs(buf[left] - buf[mid]) % 2) {
      // 奇数の幅で、両端が異性
      // または偶数の幅で、両端が同性
      // [left,mid]について
      right = mid;
    } else {
      left = mid;
    }
  }
  return 0;
}


Measured memory_bytes: 1236
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <cmath>
#include <limits>
#include <sstream>

using namespace std;

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

	int p = 0;

	for (int i = 0; i < 10; i++)
	{
		cin >> a[i];
	}

	for (int i = 0; i < 10; i++)
	{
		p += a[i];
	}

	cout << p << endl;
}



Measured memory_bytes: 3072
while 1:
    h,w=map(int,input().split())
    if w==0:break
    a=[input() for _ in[0]*h]
    b=[(0,0)];i=j=0
    while a[i][j]!='.':
        if a[i][j]=='>':j+=1
        elif a[i][j]=='<':j-=1
        elif a[i][j]=='v':i+=1
        elif a[i][j]=='^':i-=1
        if (i,j) in b:print('LOOP');break
        b+=[(i,j)]
    else:print(j,i)

Measured memory_bytes: 7688
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll ans = -0x3f3f3f3f3f3f3f3f;
    ans = max(b*d,ans);
    ans = max(a*c,ans);
    ans = max(a*d,ans);
    ans = max(b*c,ans);
    cout << ans << endl;
    return 0;
}

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

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            var tmp = Console.ReadLine().Split().Select(t => long.Parse(t)).ToArray();
            var x = tmp[0];
            var y = tmp[1];

            int count = 1;
            while (true)
            {
                x *= 2;
                if (x > y)
                    break;

                count++;
            }
            Console.WriteLine(count);
        }
    }
}


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

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int main() {
	ll n, x;
	cin >> n >> x;
	
	ll ans = 0;
	if (n == x * 2) {
		ans = 3 * x;
	} else {
		bool f; //true: 上に上がる false:左に進む
		
		ll a = x, b = n - x; //a < b
		
		if (a < b) f = true;
		else {
			f = false;
			swap(a, b);
		}
		ans = a + b;
		while (true) {
			ans += (b / a) * 2 * a;
			
			if (b % a == 0) break;
			
			f = !f;
			ll tmp = a;
			a = b % a;
			b = tmp;
		}
		ans -= a;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
A,B,C,D = list(map(int,input().split()))

if A%D != 0:
    E = A//D+1
else:
    E = A//D

if C%B != 0:
    F = C//B +1
else:
    F = C//B
    
if E > F:
    print("Yes")
elif E < F:
    print("No")

else:
    print("Yes")

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

using namespace std;
long q,n,d;
int a[8];
void np(long & n,long i)
{
    if(n>=pow(2,i-1)) {
        a[i]=1;
        n=n-pow(2,i);
    }
    else a[i]=0;
}
int main()
{
    cin>>q;
    while(q--)
    {
        cin>>n>>d;
        if(n%2==1) cout<<(n-1)*127+d;
        else{
        long cc=(d^127);
        cout<<(n-1)*127+cc;

    }
    cout<<endl;
    }



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair

int main(){
	ll n,m;
	cin >> n >> m;
	priority_queue<ll> que;
	for(ll i=0;i<n;i++){
		ll a;
		cin >> a;
		que.push(a);
	}
	if(n==1){
		ll b=que.top();
		for(ll i=0;i<m;i++){
			b/=2;
		}
		cout << b << endl;
		return 0;
	}
	while(m>=1){
		ll b=que.top();
		que.pop();
		b/=2;
		que.push(b);
		m--;
	}
	ll res=0;
	while(!que.empty()){
		ll c=que.top();
		que.pop();
		res+=c;
	}
	cout << res << endl;
	return 0;
}


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

int main(){
  int K,A,B;
  cin >> K >> A >> B;
  
  bool ans = true;
  for(int i=A; i<=B; i++){
    if(i%K==0){
      cout << "OK" << endl;
      ans = false;
      break;
    }
  }
  if(ans) cout << "NG" << endl;
}

Measured memory_bytes: 3616
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <ctime>
#include<complex>
using namespace std;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;

const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const LL LINF = INF * (LL)INF;

const int MAX = 1000 * 1000 + 47;

int SH[MAX];
int R[MAX];
int L[MAX];
int H[MAX];

string s, t;

void imp()
{
	cout << -1 << endl;
	exit(0);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n >> s >> t;
	if (s == t)
	{
		cout << 0 << endl;
		return 0;
	}

	FOR(i, 0, n)
	{
		R[i] = -1;
	}
	int p = n - 1;

	RFOR(i, n, 0)
	{
		while (p != -1 && t[i] != s[p]) p--;
		if (p == -1) imp();
		L[p] = i;
		R[p] = max(i, R[p]);
		if (i == p) p--;
	}

	int sh = 0, add = 0;
	int ans = 0;
	RFOR(i, n, 0)
	{
		H[i + sh] = -add;
		if (R[i] == -1)
		{
			continue;
		}

		ans = max(ans, H[R[i] + sh] + add + 1);
		sh++;
		add++;
	}

	//FOR(i, 0, n)
	//{
	//	cout << R[i] << " ";
	//}
	//cout << endl;
	//FOR(i, 0, n)
	//{
	//	cout << H[i] << " ";
	//}
	//cout << endl;
	cout << ans << endl;
}

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

int main()
{
    int n, count = 0;
    cin >> n;

    rep(i, n)
    {
        if ((i + 1) <= 9 || ((i + 1) >= 100 && (i + 1) <= 999) || ((i + 1) >= 10000 && (i + 1) <= 99999) || ((i + 1) >= 1000000 && (i + 1) <= 9999999) || ((i + 1) >= 100000000 && (i + 1) <= 999999999))
            count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>

#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
#define ALL(X) X.begin(), X.end()
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
typedef std::pair<LL,LL> PLL;//
typedef std::pair<int,int> PII;//
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18+20;
const LD PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;

void solve(){
	string str;
	cin >> str;
	int size = str.size();
	vector< int > dp(26,0);
	LL ans = 0;
	for(int i=size-1;i>=0;--i){
		int res = str[i]-'a';
		ans += (size-1 -i) - dp[res];
		dp[res]++;
	}
	cout << ans+1 << endl;
}

#pragma region main
signed main(void){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}
#pragma endregion //main()

Measured memory_bytes: 720
#include<cstdio>
int main(){
	  int a,b,c,count=0;
	  scanf("%d%d%d",&a,&b,&c);
	  for(int i=a;i<=b;i++){
	      if(c%i==0){
			  count+=1;
		  }
	  }
	  printf("%d\n",count);
	
}

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

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

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define vuni(v) v.erase(unique(v.begin(), v.end()), v.end());
#define mins(m, s) m.insert(make_pair(s, 1));
#define mfin(m, s) m.find(s) != m.end()

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl

const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9 + 7;

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

    int ans = t.length();
    for(int i = 0; i < s.length() - t.length() + 1; i++) {
        string str = s.substr(i, t.length());
        int now = 0;
        for(int j = 0; j < t.length(); j++) {
            if(t[j] != str[j]) {
                now++;
            }
        }
        ans = min(ans, now);
    }

    cout << ans << endl;

    return 0;
}

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

using i64 = int_fast64_t;
using f64 = double;

constexpr i64 INF = INT_FAST64_MAX / 2;
constexpr f64 EPS = DBL_EPSILON;

void solve() {
    i64 n;
    cin >> n;
    vector<vector<i64>> mat(n, vector<i64>(n, INF));
    for (i64 i = 0; i < n; i++) {
        for (i64 j = 0; j < n; j++) {
            char c;
            cin >> c;
            if (i == j) mat[i][j] = 0;
            if (c == '1') mat[i][j] = 1;
        }
    }

    vector<i64> b(n, -1);
    b[0] = 0;
    queue<i64> q;
    q.push(0);
    while (!q.empty()) {
        i64 t = q.front(); q.pop();
        for (i64 i = 0; i < n; i++) {
            if (t == i) continue;
            if (mat[t][i] == INF) continue;
            if (b[i] != -1) {
                if (b[t] ^ b[i]) continue;
                cout << -1 << endl;
                return;
            }
            b[i] = !b[t];
            q.push(i);
        }
    }

    for (i64 i = 0; i < n; i++) {
        for (i64 j = 0; j < n; j++) {
            for (i64 k = 0; k < n; k++) {
                mat[j][k] = min(mat[j][k], mat[j][i] + mat[i][k]);
            }
        }
    }

    i64 ans = 0;
    for (auto& e : mat) {
        for (auto& f : e) {
            ans = max(ans, f);
        }
    }

    cout << ans + 1 << endl;
}

int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() 
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll x,n;
    cin>>x>>n;
    set<ll> s1;
    for (int i = 0; i < 110; ++i)
    {
        s1.insert(i);
    }
    for (int i = 0; i < n; ++i)
    {
        ll a;
        cin>>a;
        if(s1.find(a)!=s1.end()){
            s1.erase(a);
        }
    }

    if(s1.find(x)!=s1.end()){
        cout<<x<<endl;
    }
    else{
        auto a1 = s1.lower_bound(x);
        if(a1==s1.begin()){
            cout<<*a1<<endl;
        }
        else{
            auto a2=a1;
            a2--;
            if(min(abs(x-*a1),abs(x-*a2))==abs(x-*a2)){
                cout<<*a2<<endl;
            }
            else{
                cout<<*a1<<endl;
            }    
        }
    }


    return 0;
}

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

#pragma region
typedef long long ll;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define rep(i, begin, end)                              \
    for (__typeof(end) i = (begin) - ((begin) > (end)); \
         i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define REP(i, j) rep(i, 0, j)
#define testcase \
    int _;       \
    cin >> _;    \
    while (_--)
#define io                            \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    if (fopen("./input.txt", "r")) freopen("./input.txt", "r", stdin);
#define en '\n'
#pragma endregion

int main() {
    io;
    int ac = 0, tle = 0, wa = 0, re = 0;
    string s;
    testcase {
        cin >> s;
        if (s == "AC")
            ac++;
        else if (s == "TLE")
            tle++;
        else if (s == "WA")
            wa++;
        else
            re++;
    }
    cout << "AC x " << ac << en << "WA x " << wa << en << "TLE x " << tle << en
         << "RE x " << re << en;
    return 0;
}

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

int main(){
  string s;
  cin >> s;
  for(int i = 0; i< s.length(); i++){
    if(s[i] != ','){
		cout << s[i];
    } else {
      	cout << " ";
    }
  }
  cout << endl;
}

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

int main() {
	int n, m; cin >> n >> m;
	int sum_a = 0;
	vector<int> a;
	for (int i = 0; i < n; ++i) {
		int A; cin >> A;
		a.push_back(A);
		sum_a += A;
	}

	sort(a.begin(), a.end(), greater<int>());
	bool ans = true;
	for (int i = 0; i < m; ++i) {
		if (4 * m * a[i] < sum_a) {
			ans = false;
			break;
		}
	}

	if (ans) cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include<algorithm> 
#include <iomanip>
#include <math.h>
#include <iostream>
#include <bitset>
#include <map>

#define db double
#define vi vector<int>
#define pb push_back
#define fi first
#define se second
#define ll long long
#define ld long double
#define maxn 5005
#define mod 998244353
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vpi vector<pii>
#define vpll vector<pll>
#define vv(z,a,b) vector<vector<int>>z(a,vector<int>(b))
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(c) begin(c),end(c)
#define pp pair<int,int>
#define fix(n) fixed << setprecision(n)
#define gmax(a,b) __gcd(a,b)
#define gmin(a,b) a/__gcd(a,b)*b
using namespace std;
//obj;
class binary{
public:
    bool isOK(int index, int key,vi a) {
    if (a[index] >= key) return true;
    else return false;
}
int binary_search(int key,vi a) {
   
    int ng = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int ok = (int)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

    /* ok と ng のどちらが大きいかわからないことを考慮 */
    while (abs(ok - ng) > 1) {
        int mid = (ok + ng) / 2;

        if (isOK(mid, key,a)) ok = mid;
        else ng = mid;
    }
    return ok;
}
}obj;

int main(){
int n,x,t;
cin>>n>>x>>t;
int b=n%x;
int a=n/x;
if(b!=0)a++;
int ans=t*a;
cout<<ans<<endl;

return 0;
 }


Measured memory_bytes: 3600
from collections import defaultdict
N = int(input())
ss = [input() for i in range(N)]
sdic = defaultdict(int)
ans = 0
for s in ss:
  dic = defaultdict(int)
  for c in s:
    dic[c] += 1
  key = tuple(sorted(dic.items()))
  sdic[key] += 1
  if sdic[key] >= 2:
    ans += sdic[key] - 1
print(ans)
    


Measured memory_bytes: 81772
n = int(input())
a_list = list(map(int, input().split()))
a_list.sort()
a_max = a_list[-1]

divisible = [False] * (a_max + 1)

count = 0
i = 0
for i in range(n):
    if divisible[a_list[i]]:
        continue
    if i < n - 1 and a_list[i] == a_list[i + 1]:
        while i < n - 1 and a_list[i] == a_list[i + 1]:
            i += 1
    else:
        count += 1
    x = a_list[i]
    while x <= a_max:
        divisible[x] = True
        x += a_list[i]
print(count)

Measured memory_bytes: 101364
#include <iostream>

int main()
{
	int n, m;
	std::cin >> n >> m;
	int *matrix = new int[n*m];
	int *vector = new int[m];
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < m; j++)
		{
			std::cin >> matrix[(i*m) + j];
		}
	}
	for (int j = 0; j < m; j++)
	{
		std::cin >> vector[j];
	}
	for (int i = 0; i < n; i++)
	{
		int result_i = 0;
		for (int j = 0; j < m; j++)
		{
			result_i += matrix[(i*m) + j] * vector[j];
		}
		std::cout << result_i << '\n';
	}
	delete[] matrix;
	delete[] vector;
	return 0;
}

Measured memory_bytes: 3116
h = int(input())
w = int(input())
n = int(input())

if h > w:
    if n % h == 0:
        print(n//h)
    else:
        print(n//h+1)
else:
    if n % w == 0:
        print(n//w)
    else:
        print(n//w+1)

Measured memory_bytes: 2940