akhauriyash/Code-Regression huggingface dataset:
/*#include<iostream>
#include<algorithm>
using namespace std;
int knapsack(int c, int items, int values[], int w[])
{
	int i = 0;
	int p;
	int dp[4][9];
	for (; i < items; i++)
	{
		for (p = 0; p <= c; p++)
		{
			if (i == 0 || p == 0)
				dp[i][p] = 0;
			else if (w[i - 1] > p)
				dp[i][p] = max(values[i] + dp[i - 1][p - w[i - 1]], dp[i - 1][p]);
			else
				dp[i][p] = dp[i - 1][p];
		}
		cout << "GGGG";
	}
	return dp[c][p];
}
int main()
{
	cout << "GGGG";
	/*map<int, int>m;
	m[10] = 100;
	m[5] = 25;
	m[3] = 9;
	m[4] = 16;
	m.insert(make_pair(10, 700));
	m.insert(make_pair(10, 600));

	for (auto it = m.begin(); it != m.end(); it++)
		cout << it->first << " " << it->second<<endl;*/
		/*multimap<int, int>m;
		m.insert(make_pair(10, 100));
		m.insert(make_pair(20, 200));
		m.insert(make_pair(30, 300));
		m.insert(make_pair(10, 700));
		m.insert(make_pair(20, 100));

		for (auto it = m.begin(); it != m.end(); it++)
			cout << it->first << " " << it->second << endl;

	int values[] = { 30,50,60 };
	int w[] = { 3,4,5 };
	int tw = 8;
	cout << "GGGG";
	cout << knapsack(tw, 3, values, w);


}*/
#include<iostream>
#include<cstring>
#include<vector>
#include<algorithm>
using namespace std;
void lcs(string s, string t, int m, int n)
{
	int dp[m + 1][n + 1];
	int i, j;
	for (i = 0; i <=m; i++)
	{
		for (j = 0; j <=n; j++)
		{
			if (i == 0 || j == 0)
				dp[i][j] = 0;
			else if (s[i-1] == t[j-1])
				dp[i][j] = 1 + dp[i - 1][j - 1];
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}
	/*for(i=0;i<=m;i++)
	{
	    for(j=0;j<=n;j++)
	    {
	        cout<<dp[i][j]<<" ";
	    }
	    cout<<endl;
	}*/
//	cout << dp[m][n];
	int index=dp[m][n];
//	char values[index+1];*/
	i=m;
	j=n;
	
	vector<char>v;
//	values[index] = '\0';
	while(i>0 && j>0)
	{
	    if(s[i-1]==t[j-1])
	    {
	        v.push_back(s[i-1]);
	        //values[index-1]=s[i-1];
	        i--;
	        j--;
	        index--;
	    }
	    else if(dp[i-1][j]>dp[i][j-1])
	    i--;
	    else
	    j--;
	}
	if(v.size()==0)
	cout<<" ";
	else{
	for(auto itr=v.end()-1;itr>=v.begin();itr--)
	cout<<*itr;}
	//cout<<values;
}
int main()
{
	int m, n;
	string s, t;
	cin >> s >> t;
	m = s.length();
	n = t.length();
	lcs(s, t, m, n);
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
#define ll long long
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define MAX 1000000007
using namespace std;
int main()
{
 	speed_up
   ll a,b;cin>>a>>b;
   if(a<=5) cout<<0;
   else if(a>=6&&a<=12) cout<<b/2;
   else cout<<b;
     
	
	
	
	
	
	
 return 0;
}

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

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

int main(){
    int n,m;
    cin >> n >> m;
    int l=0,r=n;
    for(int i=0;i<m;i++){
        int a,b;
        cin >> a >> b;
        l=max(l,a);
        r=min(r,b);
    }
    cout << max(0,r-l+1) << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>

using namespace std;

int main(){
	long long n, a, b;
	double ans1 = 0.0;
	cin >> n >> a >> b;
	vector<long long> v(n);
	for(int i = 0; i < n; i++){
		cin >> v[i];
	}
	sort(rbegin(v), rend(v));
	for(int i = 0; i < a; i++){
		ans1 += v[i];
	}
	ans1 /= a;
	cout << fixed << ans1 << endl;
	vector<vector<long long>> conb(51, vector<long long>(51));
	for(int i = 0; i < 51; i++){
		conb[i][0] = 1;
		for(int j = 1; j <= i; j++){
			conb[i][j] = conb[i - 1][j] + conb[i - 1][j - 1];
		}
	}
	long long t = v[a - 1], ans2 = 0;
	int cnt = 0, l = 0;
	for(int i = 0; i < n; i++){
		if(v[i] == t){
			cnt++;
		}else if(v[i] > t){
			l++;
		}else{
			break;
		}
	}
	if(l == 0){
		for(int i = a; i <= b; i++){
			ans2 += conb[cnt][i - l];
		}
	}else{
		ans2 = conb[cnt][a - l];
	}
	cout << ans2 << endl;
	return 0;
}

Measured memory_bytes: 384
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int n;
  cin >> n;
  cout << 10 - n / 200 << "\n";
}

int main()
{
  init_main();
  solve();
}

Measured memory_bytes: 3664
#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;

typedef long long lo;

template<typename tp> inline void read(tp &x) {
    x = 0; char c = getchar(); int f = 0;
    for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
    for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
    if (f) x = -x;
}
#define int long long

signed main(void) {
    int N, A;
    read(N); read(A);
    int ans = N;
    for (int ch = 1; ch <= 100; ch++) {
	int big = 1;
	while (pow(big, ch + 1) < N) ++big;
	for (int cnt = ch; cnt >= 0; cnt--) {
	    int now = 1;
	    rep (_, cnt) now *= big - 1;
	    rep (_, ch + 1 - cnt) now *= big;
	    if (now >= N) {
		ans = min(ans, (big - 1) * cnt + big * (ch + 1 - cnt) + ch * A);
		break;
	    }
	}
    }
    cout << ans << "\n";
}



Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}
typedef long long ll;
typedef pair<ll, ll> P;
map<long long, long long> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
signed main() {
    ll n;
    cin >> n;
    ll ini = n;
    ll length = 0;
    REP(i, 30) {
        n = n - modpow(26, i + 1);
        if (n <= 0) {
            length = i + 1;
            n = n + modpow(26, i + 1);
            break;
        }
    }
  n--;
  	string s;
  while(n > 0){
  	s += 'a' + n%26;
    n/=26;
  }
  s += string(length-s.length(), 'a');
  reverse(s.begin(),s.end());
  cout << s << endl;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

int n, q;
vector<int> G[200010], ans;

void dfs(int now, int pre)
{
    rep(i, G[now].size())
    {
        if (G[now][i] == pre)
            continue;
        ans[G[now][i]] += ans[now];
        dfs(G[now][i], now);
    }
}

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

    cin >> n >> q;
    rep(i, n - 1)
    {
        int a, b;
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    ans.resize(n);
    rep(i, q)
    {
        int p, x;
        cin >> p >> x;
        p--;
        ans[p] += x;
    }
    dfs(0, -1);
    rep(i, n) cout << ans[i] << " ";
    cout << endl;
}

Measured memory_bytes: 27392
n, m = map(int,input().split())


def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

N = 10**6
mod = 10**9+7
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

if (n+m) % 3 != 0:
    print(0)
elif m/n > 2 or n/m > 2:
    print(0)
else:
    t = int((n+m)/3)+1
    k = int(min(n-t+1,m-t+1))+1
    print(cmb(t-1,k-1,10**9+7))

Measured memory_bytes: 122040
A=?a.ord
def to_ind(c)
  c.ord-A
end

s=gets.chomp
t=gets.chomp

table=Array.new(26){Array.new(26,false)}

s.size.times{|i|
  table[to_ind(s[i])][to_ind(t[i])]=true
}

b1=table.all?{|row|row.count(true)<=1}
b2=table.transpose.all?{|row|row.count(true)<=1}

puts b1&&b2 ? "Yes" : "No"

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[1010];
li b[1010];
li la = 0;
li lb = 0;
li n, m;

set<li> sta;
set<li> stb;

int main() {
    cin >> n >> m;
    rep(i, n) {
        cin >> a[i];
        sta.insert(a[i]);
    }
    rep(j, m) {
        cin >> b[j];
        stb.insert(b[j]);
    }
    if (sz(sta) != n || sz(stb) != m) {
        puts("0");
        return 0;
    }

    li res = 1;
    li num = 0;
    for (li i = n * m; i > 0; --i) {
        if (sta.count(i) > 0) {
            if (stb.count(i) > 0) {
                la++;
                lb++;
            } else {
                res = (res * lb) % MOD;
                la++;
            }
        } else if (stb.count(i) > 0) {
            res = (res * la) % MOD;
            lb++;
        } else {
            res = (res * (la * lb - num)) % MOD;
        }
        num++;
        //p2(i, res);
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 384
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  bool f = false;
  if(a + b >= c) f = true;
  YesorNo(f);
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ALL(a)  (a).begin(),(a).end()
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<long long, long long> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
template <typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
const int INT_INF = 1 << 30;
const double PI = acos(-1.0);
#define MOD 1000000007LL
#define endl "\n"

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand((unsigned)time(NULL));
  ll N;
  cin >> N;
  vll A(N);
  for(int i = 0; i < N; i++){
    cin >> A.at(i);
  }
  vector<Pll> box(0);
  box.push_back(Pll(A.at(0), A.at(0)));
  for(int i = 1; i < N; i++){
    if(box.back().second < A.at(i)) box.back().second = A.at(i);
    else if(box.back().second > A.at(i)) box.push_back(Pll(A.at(i), A.at(i)));
  }
  ll money = 1000LL, stock = 0LL;
  for(int i = 0; i < sz(box); i++){
    ll n = money / box.at(i).first;
    money %= box.at(i).first;
    money += n * box.at(i).second;
  }
  cout << money << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--)
#define reprev(i,n) reprrev(i,0,n)
typedef long long ll;
typedef unsigned long long ull;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

const ll mod = 1e9+7;

void chmod(ll &M){
    if(M >= mod) M %= mod;
    else if(M < 0){
        M += (abs(M)/mod + 1)*mod;
        M %= mod;
    }
}

ll modpow(ll x, ll n){
    if(n == 0) return 1;

    ll res = modpow(x, n/2);
    if(n%2 == 0) return res*res%mod;
    else return res*res%mod*x%mod;
}

ll power(ll x, ll n){
    if(n == 0) return 1;

    ll res = power(x, n/2);
    if(n%2 == 0) return res*res;
    else return res*res*x;
}

int getl(int i, int N) { return i==0? N-1:i-1; };
int getr(int i, int N) { return i==N-1? 0:i+1; };

/* <--------------------------------------------> */

typedef tuple<ll, ll, ll> T;
// get<K>(tuple型の変数)

const int inf=1001001001;
int n;
vector<int> to[1005];

// sv を始点とするループの最短距離とその経路復元
vector<int> bfs(int sv){
    vector<int> dist(n, inf),  pre(n, -1);
    queue<int> q;
    dist[sv]=0;
    q.push(sv);

    while(!q.empty()){
        int u=q.front(); q.pop();
        for(auto v:to[u]){
            if(dist[v]!=inf) continue;
            dist[v]=dist[u]+1;
            pre[v]=u;
            q.push(v);
        }
    }

    pair<int, int> best(inf, 0);
    rep(u,n){
        if(u==sv) continue;
        for(auto v:to[u]){
            if(v==sv) chmin(best, make_pair(dist[u], u));
        }
    }
    if(best.first==inf) return vector<int>(n+1);
    int v=best.second;
    vector<int> res;
    while(v!=-1){
        res.push_back(v);
        v=pre[v];
    }
    return res;
}

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

    int m; cin >> n >> m;
    rep(i,m){
        int a, b; cin >> a >> b; --a; --b;
        to[a].push_back(b);
    }

    vector<int> ans(n+1, 0);
    rep(i,n){
        auto now=bfs(i);
        if(now.size() < ans.size()) ans=now;
    }
    if(ans.size()==n+1){
        cout << -1 << endl;
        return 0;
    }

    cout << ans.size() << endl;
    for(int v:ans) cout << v+1 << endl;
    
    return 0;
}



Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>

#define rep(i, n) for (int i = 0; i < n; i = i + 1)
#define array(N, t) (t*)calloc(N, sizeof(t))
#define ll long long
#define INF ((1LL << 62) - (1LL << 31))
#define max(p, q)((p) > (q) ? (p) : (q))
#define min(p, q)((p) < (q) ? (p) : (q))

char N[200010];
int main(){
  scanf("%s", N);
  int sum = 0;
  for (int i = 0; N[i] != '\0'; i += 1) {
    sum += N[i] - '0';
  }
  if (sum % 9 == 0) {
    puts("Yes");
  } else {
    puts("No");
  }
}


Measured memory_bytes: 1800
#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second

const int maxn = 200000 + 100;
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
ll prefix[maxn];
int seq[maxn];
int main(){
    int n;
    cin >> n;
    ll sum = 0;
    for (int i = 1 ;i <= n;i++){
        cin >> seq[i];
        sum += seq[i];
    }
    ll mind = 10000000000000000LL;
    for (int i= 1;i < n;i++){
        prefix[i] = prefix[i - 1 ] + seq[i];
        mind = min(mind,abs(prefix[i] - (sum - prefix[i])));
    }
    cout << mind << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
  long N,Q;cin>>N>>Q;
  vector<vector<long>>A(N);
  for(long i=0;i<N-1;i++){
    long a,b;cin>>a>>b;
    A[a-1].push_back(b-1);
    A[b-1].push_back(a-1);
  }
  
  vector<long>X(N),Y(N);
  for(long i=0;i<Q;i++){
    long p,x;cin>>p>>x;
    X[p-1]+=x;
  }
  queue<long>q;q.push(0);
  vector<bool>used(N);used[0]=1;
  while(q.size()){
    long p=q.front();q.pop();
    Y[p]+=X[p];
    for(long n:A[p])if(used[n]==0){
      q.push(n);
      used[n]=1;
      X[n]+=X[p];
    }
  }
  for(long i=0;i<N;i++)cout<<Y[i]<<" ";
  
}

/*




*/



Measured memory_bytes: 20504
def Z(): return int(input())
def ZZ(): return [int(_) for _ in input().split()]

def main():
    H1, M1, H2, M2, K = ZZ()
    start = 60 * H1 + M1
    end = 60 * H2 + M2
    print(max(0, end - start - K))

    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 9164
#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)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
double dp[511][111][111];
int main(){
    int h,n,p,m,k;
    cin>>h>>n>>p>>m>>k;
    --p;
    vector<int> a(h);
    rep(i,m){
        int x,y;
        cin>>x>>y;
        --x;
        a[x]=y;
    }

    dp[h][0][p]=1.0;
    int all=h-m;
    for(int i=h-1;i>=0;--i){
        for(int j=0;j<k+1;j++){
            if(a[i]){
                for(int l=0;l<n;++l){
                    if(l==a[i]-1)dp[i][j][l+1]=dp[i+1][j][l];
                    else if(l==a[i])dp[i][j][l-1]=dp[i+1][j][l];
                    else dp[i][j][l]=dp[i+1][j][l];
                }
            }
            else {
                double prob=1.0-1.0*(k-j)/all;
                for(int l=0;l<n;++l){
                    dp[i][j][l]+=prob*dp[i+1][j][l];
                }
                prob = 1.0*(k-j)/all/(n-1);
                for(int x=1;x<=n-1;++x){
                    for(int l=0;l<n;++l){
                        if(l==x-1)dp[i][j+1][l+1]+=prob*dp[i+1][j][l];
                        else if(l==x)dp[i][j+1][l-1]+=prob*dp[i+1][j][l];
                        else dp[i][j+1][l]+=prob*dp[i+1][j][l];
                    }
                }
            }
        }
        if(!a[i])--all;
    }
    double ans=0;
    rep(i,n){
        ans=max(ans,dp[0][k][i]);
    }
    cout<<setprecision(12)<<ans<<endl;
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  int ans = x - a - b * ((x - a) / b);
  cout << ans << endl;
  return 0;
}


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

#define endl '\n'
#define ends ' '
#define die(x) return cout << x << endl, 0
#define all(v) v.begin(), v.end()
#define sz(x) (int)(x.size())
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cerr << ends << H; debug_out(T...); }
#define debug(...) cerr << "{" << #__VA_ARGS__ << "}:", debug_out(__VA_ARGS__)
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
 
////////////////////////////////////////////////////////////////////

const int N = 7e2 + 5;

bool DP[N][N];
bool A[N][N];
vector<int> G[N];
int M[N], C[2];

bool DFS(int v, int c = 1) {
	M[v] = c, C[c - 1]++;
	for (int u : G[v]) if ((M[u] && c == M[u]) || (!M[u] && !DFS(u, 3 - c))) return false;
	return true;
}
int nC2(int n) { return n * (n - 1) / 2; }

int main() {

	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	mt19937 Rnd(time(0));
	
	int n, m; cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int v, u; cin >> v >> u;
		A[v][u] = A[u][v] = true;
	}
	for (int i = 1; i <= n; i++) for (int j = 1; j <= n; j++) if (i != j && !A[i][j]) G[i].push_back(j);
	vector<pii> V;
	for (int i = 1; i <= n; i++) if (!M[i]) {
		C[0] = C[1] = 0;
		bool bip = DFS(i);
		if (!bip) die(-1);
		V.push_back(make_pair(C[0], C[1]));
	}
	DP[0][0] = 1;
	for (int i = 0; i < sz(V); i++) {
		int a = V[i].first, b = V[i].second;
		for (int j = 0; j <= n; j++) {
			if (j >= a) DP[i + 1][j] |= DP[i][j - a];
			if (j >= b) DP[i + 1][j] |= DP[i][j - b];
		}
	}
	int ans = INF;
	for (int i = 1; i < n; i++) if (DP[sz(V)][i]) ans = min(ans, nC2(i) + nC2(n - i));
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>

int main(void){
  char s[4];
  int n=0,i,ch;
  
  for(i=0;i<4;i++){
    s[i] = getchar();
  }
  
  for(i=0;i<4;i++){
    if(s[i]=='+'){
      n++;
    }else if(s[i]=='-'){
      n--;
    }
  }
  
  printf("%d\n",n);
  
  return 0;
}

Measured memory_bytes: 128
main = do
  inputs <- map(read::[Char]->Int) <$> words <$> getLine
  let a = head inputs
      b = last inputs
  putStr $ judge a b

judge::Int->Int->String
judge x y | x <= 0 && y >= 0 = "Zero"
          | x > 0 && y > 0 = "Positive"
          | odd $ y - x = "Positive"
          | otherwise = "Negative"

Measured memory_bytes: 508
#include <iostream>

using namespace std;

int main() {
  int w, h, n;
  cin >> w >> h >> n;
  int x1 = 0, y1 = 0, x2 = w, y2 = h;
  for (int i = 0; i < n; i++) {
    int x, y, a;
    cin >> x >> y >> a;
    switch (a) {
    case 1:
      x1 = max(x1, x);
      break;
    case 2:
      x2 = min(x2, x);
      break;
    case 3:
      y1 = max(y1, y);
      break;
    case 4:
      y2 = min(y2, y);
      break;
    }
  }
  cout << max(0, x2 - x1) * max(0, y2 - y1) << endl;
  return 0;
}


Measured memory_bytes: 256
s=input()
n=len(s)
for i in range(1,n):
    if(s[i-1]==s[i]):
        print(i,i+1)
        break
    elif(i>1 and s[i-2]==s[i]):
        print(i-1,i+1)
        break
else:
    print(-1,-1)


Measured memory_bytes: 69844
#include<bits/stdc++.h>
inline int input() { int x; scanf("%d", &x); return x; }
const int maxn = 505;
int f[maxn], g[maxn];
int a[maxn][maxn];

void get(int l, int r) {
    int n = r - l + 1;
    if(n <= 2) {
        a[l][r] = f[n];
        return;
    }
    int mid = l + g[n] - 1;
    get(l, mid);
    get(mid + 1, r);
    for(int i = l; i <= mid; i ++)
        for(int j = mid + 1; j <= r; j ++)
            a[i][j] = f[n];
}

int main() {
    int n = input();
    f[1] = f[2] = 1;
    for(int i = 3; i <= n; i ++) {
        f[i] = 1000000000;
        for(int j = 1; j < i; j ++) {
            int v = std::max(f[j], f[i - j]) + 1;
            if(v < f[i]) {
                f[i] = v;
                g[i] = j;
            }
        }
    }
    get(1, n);
    for(int i = 1; i < n; i ++) {
        for(int j = i + 1; j <= n; j ++)
            printf("%d ", a[i][j]);
        puts("");
    }
}

Measured memory_bytes: 1536
S = list(map(int, input()))
a = [0 if (i+1)%2 == 0 else 1 for i in range(len(S))]
b = [0 if (i+1)%2 == 1 else 1 for i in range(len(S))]
ans0, ans1 = 0, 0
ans0 = [0 for i, j in zip(a, S) if i == j]
ans1 = [0 for i, j in zip(b, S) if i == j]
print(min(len(ans0), len(ans1)))


Measured memory_bytes: 12208
//============================================================================
// Name        : MatrixChainMultiplication.cpp
// Author      : Ken
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <map>
using namespace std;

struct Matrix{
	int row;
	int col;
};

class MatrixList{
public:
	vector<Matrix> matrices;
	map<string, int> minProcess;
	map<string, int>::iterator p;
	MatrixList():matrices(), minProcess(){}

	void insert(const Matrix& mat){
		matrices.push_back(mat);
	}

	int calcMinProcess(int i, int j){
		if(not(i>=0 and i<j and j<=matrices.size())){
			cout << "calcMinProcess: i and j are invalid\n";
			return -1;
		}

		string key = to_string(i) + ":" + to_string(j);

		p = minProcess.find(key);
		if(p != minProcess.end()){
			return minProcess[key];
		}

		if(j == i+1){
			return 0;
		}

		int min = 100000000;

		for(int k=i+1; k<j; k++){
			int tmp = calcMinProcess(i, k) + calcMinProcess(k, j) + matrices.at(i).row * matrices.at(k-1).col * matrices.at(j-1).col;
			if(tmp < min){
				min = tmp;
			}
		}

		minProcess[key] = min;
		return min;
	}

	void writeMatList(){
		for(int i=0; i<matrices.size(); i++){
			cout << matrices.at(i).row << " " << matrices.at(i).col << "\n";
		}
	}
};

int main() {
	int n, row, col;
	cin >> n;
	MatrixList matList;

	for(int i=0; i<n; i++){
		cin >> row >> col;
		Matrix mat = {row, col};
		matList.insert(mat);
	}

	//matList.writeMatList();
	cout << matList.calcMinProcess(0, matList.matrices.size()) << "\n";

	return 0;
}



Measured memory_bytes: 3816
input = input().split(" ")
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
x10 = int(input[0])
xn = Base_10_to_n(x10, int(input[1]))
print(len(xn))

Measured memory_bytes: 38256
MOD = 10 ** 9 + 7

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

from itertools import accumulate

def mulmod(a, b):
    return a * b % MOD
    
from_left = list(accumulate(range(N-1, 1, -1), mulmod))[::-1] + [1]
from_right = [1] + list(accumulate(range(1, N-1), mulmod))
count = list(accumulate([mulmod(l, r) for l, r in zip(from_left, from_right)]))

ans = 0
for i in range(N-1):
    ans += (xs[i+1] - xs[i]) * count[i]
    ans %= MOD

print(ans)


Measured memory_bytes: 105080
from collections import deque

INF = 10**18

H, W = map(int, input().split())
S = [input() for _ in range(H)]

live_cell_count = 0
for S_line in S:
    live_cell_count += S_line.count(".")

dist = [[INF for _ in range(W)] for _ in range(H)]
dist[0][0] = 0
q = deque([(0, 0)])
while q:
    t_pos = tx, ty = q.popleft()
    t_dist = dist[ty][tx]

    for dx, dy in ((0, 1), (1, 0), (-1, 0), (0, -1)):
        pos = x, y = tx+dx, ty+dy
        if not (0 <= x < W and 0 <= y < H):
            continue
        elif S[y][x] == "#":
            continue
        elif dist[y][x] <= t_dist + 1:
            continue
        dist[y][x] = t_dist + 1
        q.append(pos)
# print(dist)

if dist[H-1][W-1] == INF:
    print(-1)
else:
    print(live_cell_count - dist[H-1][W-1] - 1)

Measured memory_bytes: 9452
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

signed main(){

  vector<int> v(3, 1);
  int a, b; cin >> a >> b;
  for(int i = 0; i < 3; i++){
    if(a-1 == i) v[i] = 0;
    if(b-1 == i) v[i] = 0;
  }
  for(int i = 0; i < 3; i++){
    if(v[i]){
      cout << i+1 << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <bitset>
using namespace std;
#define ll long long 
#define ld long double
#define mod7 1000000007
#define mod9 1000000009
#define mod 1000003
#define fast ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define mp make_pair
#define pb push_back
#define ct ll t;cin>>t;while(t--)
#define bi begin()
#define ei end()
#define fi first 
#define se second

//   ll flag[100005]={0};
	// ll a[100005]={0};
	// ll b[100005]={0}; 
	// vector<ll>v(100005);     	
bool isPrime(ll n) 
{ 
	// Corner case 
	if (n <= 1) 
		return false; 
	
	// Check from 2 to n-1 
	for (ll i = 2; i*i <= n; i++) 
		if (n % i == 0) 
			return false; 
	
	return true; 
}
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = (res%mod) * (a%mod);
        a = (a%mod) * (a%mod);
        b >>= 1;
    }
    return res%mod;
}

bool compare(const pair<ll,ll>&a,const pair<ll,ll>&b)
{
    return (a.se<b.se);
}
ll lcm(ll a,ll b)
{
	return(a*b)/__gcd(a,b);
}
void SieveOfEratosthenes() 
{  
	ll n=100005;
    bool prime[100005]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        
        if (prime[p] == true) 
        {   
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
	for(ll i=2;i<100005;i++)
	{
		if(prime[i])
		{
			// v.pb(i);
		}
	}
	
} 
ll fact[1000007]={0};
ll expo(ll x, ll y) {ll res=1;x=x%mod7;while(y>0){if(y&1)res=(1ll*res*x)%mod7;
y=y>>1;x=(1ll*x*x)%mod7;} return res;}
void facto() {fact[0]=1;fact[1]=1;for(ll i=2;i<100007;i++)fact[i]=(fact[i-1]*i)%mod7;}
ll npr(ll n,ll r) {facto(); ll res=1; res=fact[n]; res=(res*(expo(fact[n-r],mod7-2)))%mod7; return res; }
ll ncr(ll n,ll r){ ll res=1; if(r>n-r)r=n-r; for(ll i=0;i<r;i++) {  res*=n-i;  res/=i+1; } return res;}
 int main()
{
    fast
	ll n,m;
	cin>>n>>m;
	ll ans=ncr(n,2)+ncr(m,2);
	if(n==1||n==0)
	{
		ans--;
	}
	if(m==1||m==0)
	{
		ans--;
	}
	cout<<ans<<"\n";
	
}




Measured memory_bytes: 256
#include <iostream>
int main()
{
  using namespace std;
  int N, i = 0, sum = 0, tmp;
  cin >> N;
  int A[N - 1];
  int B[N];
  for (i = 0; i < N; i++)
  {
    B[i] = 0;
  }
  i = 0;
  while (i < N - 1)
  {
    cin >> A[i];
    i++;
  }
  for (i = 0; i < N - 1; i++)
  {
    tmp = A[i];
    B[tmp - 1] += 1;
  }
  for (i = 0; i < N; i++)
  {
    cout << B[i] << endl;
  }

  return 0;
}

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

typedef unsigned long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;

#define INF (int)(1e9)

#define rep(i,n) for(int i=0; i<(n); ++i)
#define REP(i,start,end) for(int i=(start);i<=(end);++i)
#define all(n) begin(n),end(n)

#define DEBUG

int main()
{
	//ios::sync_with_stdio(false); cin.tie(0);
	int n;
	cin >> n;
	vi x(n);
	rep(i,n) cin >> x[i];

	ll pos = 0;
	rep(i,n) pos += x[i];

	ll ans1 = 0;
	ll ans2 = 0;
	rep(i,n)
	{
		ans1 += (x[i] - (pos + n - 1) / n) * (x[i] - (pos + n - 1) / n);
	}
	rep(i,n)
	{
		ans2 += (x[i] - (pos / n)) * (x[i] - (pos / n));
	}

	ll ans = min(ans1, ans2);
	cout << ans << endl;
	return 0;
}

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

#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())
#define endl '\n'

using namespace std;

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

const int maxn = 85;
const int INF = 1e9+10;

ii g[maxn][maxn];
int dp[maxn][maxn][2*maxn*maxn];
int w,h;

int get_ans(int i,int j,int somaa,int somab,int diff){
	if(i>h || j>w)
		return INF;
	if(dp[i][j][diff]!=-1)
		return dp[i][j][diff];
	if(i==h && j==w){
		int s1 = (somaa+g[i][j].ff);
		int s2 = (somaa+g[i][j].ss);
		int s3 = (somab+g[i][j].ff);
		int s4 = (somab+g[i][j].ss);
		return min(abs(s1-s4),abs(s2-s3));
	}
	int ans1 = get_ans(i+1,j,somaa+g[i][j].ff,somab+g[i][j].ss,abs((somaa+g[i][j].ff)-(somab+g[i][j].ss)) );
	int ans2 = get_ans(i+1,j,somaa+g[i][j].ss,somab+g[i][j].ff,abs((somaa+g[i][j].ss)-(somab+g[i][j].ff)) );
	int ans3 = get_ans(i,j+1,somaa+g[i][j].ff,somab+g[i][j].ss,abs((somaa+g[i][j].ff)-(somab+g[i][j].ss)) );
	int ans4 = get_ans(i,j+1,somaa+g[i][j].ss,somab+g[i][j].ff,abs((somaa+g[i][j].ss)-(somab+g[i][j].ff)) );

	return dp[i][j][diff]=min({ans1,ans2,ans3,ans4});
}

int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	//#endif
	cin>>h>>w;
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			cin>>g[i][j].ff;
		}
	}
	for(int i=1;i<=h;++i){
		for(int j=1;j<=w;++j){
			cin>>g[i][j].ss;
		}
	}
	memset(dp,-1,sizeof dp);
	cout<<get_ans(1,1,0,0,0)<<endl;
	return 0;
}

Measured memory_bytes: 816128
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a+b > c+d) cout << "Left" << endl;
    else if (a+b == c+d) cout << "Balanced" << endl;
    else cout << "Right" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 2*1e13;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////

ll k,n;
Vi a;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    cin>>k>>n;
    a.resize(n);
    rep(i,n)cin>>a[i];
    ll ans = n;
    ll tmp = k-a[n-1]+a[0];
    rep(i,n){
        if(i==0)continue;
        chmax(tmp,a[i]-a[i-1]);
    }
    print(k-tmp);
    return 0;
}

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

int n, k;
std::string s;
char my_tolower(char ch)
{
    return static_cast<char>(std::tolower(static_cast<unsigned char>(ch)));
}
int main() {
    std::cin >> n >> k;
    std::cin >> s;
    s[k-1] = my_tolower(s[k-1]);
    std::cout << s << std::endl;
}


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

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

  vector<ll> p(n);
  for (ll i = 0; i < n; i++) {
    cin >> p[i];
  }

  ll min = n + 1;
  ll cnt = 0;

  for (ll i = 0; i < n; i++) {
    if (p[i] < min) {
      min = p[i];
      cnt++;
    }
  }
  cout << cnt << endl;
}


Measured memory_bytes: 1792
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = min(A) + min(B)
for _ in range(m):
  x, y, c = map(int, input().split())
  temp = A[x-1] + B[y-1] - c
  ans = min(ans, temp)
print(ans)

Measured memory_bytes: 18612
#include <bits/stdc++.h>
typedef long long LL;
using namespace std;

int main() {
  LL q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;

  LL H = min(h, 2 * q);
  LL S = min(s, 2 * H);
  LL ans;
  if (d >= 2 * S) {
    ans = n * S;
  } else {
    ans = (n / 2) * d + (n % 2) * S;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
abk = input().split()
abk = [int(i) for i in abk]
a, b, k = abk[0], abk[1], abk[2]
divisor = []
for i in range(min(a, b)):
    j = i + 1
    if a % j == 0 and b % j == 0:
        divisor.append(j)
divisor.reverse()
print(divisor[k-1])


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

int main() {
    ll N, K, Q; cin >> N >> K >> Q;
    vector<ll> correct(100100); 
    for(int i = 0; i < N; i++) correct[i] = 0;

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

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

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

    string s, t;
    cin >> s >> t;
    
    int count = 0;
    
    rep(i,s.size()){
        if(s[i] == t[i]) count++;
    }
    
    cout <<  count << endl;

    return 0;
}

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

    scanf("%d",&N);

    if(N / 100 == 7) {
        printf("Yes\n");
    } else if( N%100 >= 70 && N%100 < 80) {
        printf("Yes\n");
    } else if(N % 10 == 7) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }

    return 0;
}

Measured memory_bytes: 1620
import java.util.Scanner

import scala.collection.Searching._
import scala.annotation.tailrec
import scala.collection.immutable.Queue
import scala.collection.mutable
import scala.io.StdIn.readLine

class IUnionFind(val size: Int) {

  private case class Node(var parent: Option[Int], var treeSize: Int)

  private val nodes = Array.fill[Node](size)(new Node(None, 1))

  def union(t1: Int, t2: Int): IUnionFind = {
    if (t1 == t2) return this

    val root1 = root(t1)
    val root2 = root(t2)
    if (root1 == root2) return this

    val node1 = nodes(root1)
    val node2 = nodes(root2)

    if (node1.treeSize < node2.treeSize) {
      node1.parent = Some(t2)
      node2.treeSize += node1.treeSize
    } else {
      node2.parent = Some(t1)
      node1.treeSize += node2.treeSize
    }
    this
  }

  def connected(t1: Int, t2: Int): Boolean = t1 == t2 || root(t1) == root(t2)

  @tailrec
  private def root(t: Int): Int = nodes(t).parent match {
    case None => t
    case Some(p) => root(p)
  }
}


object Main {
  def solve(sc: => Scanner): Unit = {
    println(sc.nextInt / 3)
  }

  def gcd(i: Long, j: Long): Long = {
    if (i < j) (gcd(j, i)) else (if (j == 0) (i) else (gcd(j, i % j)))
  }

  def main(args: Array[String]): Unit = {
    val sc: Scanner = new Scanner(System.in)
    solve(sc)
  }
}

Measured memory_bytes: 27204
#include<stdio.h>
#include<string.h>
#define LEN 100005

typedef struct pp{
  char name[100];
  int t;
} P;

P Q[LEN];
int head, tail, n;

void enqueue(P x) {
   Q[tail] = x;
   tail = (tail + 1) % LEN;
}

P dequeue() { 
  P x = Q[head];
  head = (head + 1) % LEN;
  return x;
}

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

int main() { 
  int elaps = 0, c;
  int i, q;
  P u;
  scanf("%d %d", &n, &q);

  for (i = 1; i <= n;i++){
    scanf("%s", Q[i].name);
    scanf("%d", &Q[i].t);
  }
  head = 1;
  tail = n + 1;

  while(head !=tail){
    u = dequeue();
    c = min(q, u.t);
    u.t -= c;
    elaps += c;
    if (u.t > 0)
      enqueue(u);
    else{
      printf("%s %d\n", u.name, elaps);
    }
  }
  return 0;
}


Measured memory_bytes: 12768
#include <bits/stdc++.h>
using namespace std;
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define pb push_back
constexpr int INF=1000000000;
int Random(int mi,int ma){
    random_device rnd;
    mt19937 mt(rnd());//32bit
    //[mi,ma]
    uniform_int_distribution<int>engine(mi,ma);
    return engine(mt);
}
int d,c[26],s[365][26],t[365];
set<int>st[26];
int toscore(int dd,int q){
    int from=t[dd],to=q,score=s[d][to]-s[d][from];
    int r=*st[from].upper_bound(dd);
    auto it=st[from].lower_bound(dd);
    it--;
    int l=*it;
    score-=(r-dd)*(dd-l);
    r=*st[to].upper_bound(dd);
    it=st[to].lower_bound(dd);
    it--;
    l=*it;
    score+=(r-dd)*(dd-l);
    return score;
}
int score=0;
void init(){
    int last[26];
    fill(last,last+26,-1);
    rep(i,d){
        int maidx=-1,ma=-INF;
        rep(j,26){
            int score=s[i][j];
            int memo=last[j];
            last[j]=i;
            rep(k,26)score-=c[k]*(i-last[k]);
            last[j]=memo;
            if(ma<score){
                ma=score;
                maidx=j;
            }
        }
        last[maidx]=i;
        t[i]=maidx;
        st[t[i]].insert(i);
    }
    rep(i,26){
        st[i].insert(-1);
        st[i].insert(d);
    }
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    cin>>d;
    rep(i,26)cin>>c[i];
    rep(i,d){
        rep(j,26){
            cin>>s[i][j];
        }
    }
    init();
    int score=0,last[26];
    fill(last,last+26,-1);
    rep(i,d){
        score+=s[i][t[i]];
        last[t[i]]=i;
        rep(j,26)score-=c[j]*(i-last[j]);
    }
    rep(_,150000){
        int dd=Random(0,d-1),q=Random(0,24);
        if(t[dd]<=q)q++;
        int to=toscore(dd,q);
        if(to>0){
            score+=to;
            int from=t[dd],to=q;
            t[dd]=to;
            st[from].erase(dd);
            st[to].insert(dd);
        }
    }
    rep(i,d)cout<<t[i]+1<<endl;
    return 0;
}

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

int main(){
  long d;
  cin >> d;
  long n = 26, csum = 0, ccost = 0;
  vector<long> c(n),last(n);
  rep(i,n){
    cin >> c[i];
    csum += c[i];
    last[i] = 0;
  }
  vector<vector<long>> s(d,vector<long>(n));
  rep(i,d)rep(j,n)cin >> s[i][j];
  vector<vector<long>> cand;
  vector<long> score;
  random_device rd{};
  vector<long> yotei(d);
  vector<long> tmp(d);
  long final_ans = 0, final_index;

  rep(jj,10){

    long ans = 0;
    rep(i,n)last[i] = 0;
    rep(i,d)yotei[i] = rd()%n;
    rep(i,d){
      ccost += csum;
      ccost -= c[yotei[i]]*(i+1 - last[yotei[i]]);
      ans -= ccost;
      last[yotei[i]] = i+1;
      ans += s[i][yotei[i]];
    }
    int ii = 0;
    while(ii < 1000){
      long new_day = rd()%d, new_con;
      while(1){
        new_con = rd()%n;
        if(yotei[new_day] != new_con)break;
      }
      long pre_con = yotei[new_day];
      yotei[new_day] = new_con;
      long tmpans = 0;
      ccost = 0;
      rep(i,n)last[i] = 0;
      rep(i,d){
        tmp[i] = yotei[i];
        ccost += csum;
        ccost -= c[yotei[i]]*(i+1 - last[yotei[i]]);
        tmpans -= ccost;
        last[yotei[i]] = i+1;
        tmpans += s[i][yotei[i]];
      }
      if(tmpans < ans)yotei[new_day] = pre_con;
      else{
        ans = tmpans;
        cand.push_back(tmp);
      }
      ii++;
    }
    if(final_ans < ans){
      final_ans = ans;
      final_index = int(cand.size()-1);
    }
  }
  rep(i,d)cout << cand[final_index][i]+1 << endl;
  return 0;
}

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

int main(){
	int n; cin >> n;
	map<string,int> mp;
	vector<string> s(n);
	bool ok = true;
	rep(i,n){
		cin >> s[i];
		mp[s[i]]++;
		if(mp[s[i]] >= 2) ok = false;
	}
	rep(i,n-1){
		if(s[i][s[i].size()-1] != s[i+1][0]) ok = false;
	}
	if(ok){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
    return 0;
}



Measured memory_bytes: 256