akhauriyash/Code-Regression huggingface dataset:
/*
   О НЕТ! ОНИ ДОГОНЯЮТ!!!
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
   🐹🐹🐹🐹🐹🐹🐹🐹🐹🐹
*/

#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;

typedef long long ll;

mt19937 rnd(228);

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif
    int n, m;
    scanf("%d%d", &n, &m);
    vector <int> a(m);
    int sum = 0;
    for (int i = 0; i < m; i++)
    {
        scanf("%d", &a[i]);
        sum += a[i] % 2;
    }
    for (int i = 0; i < m; i++)
    {
        if (a[i] % 2)
        {
            if (a[0] % 2 == 0)
            {
                swap(a[0], a[i]);
            }
            else
            {
                swap(a[i], a[m - 1]);
            }
        }
    }
    if (sum > 2)
    {
        puts("Impossible");
        return 0;
    }
    if (m == 1)
    {
        if (a[0] == 1)
        {
            cout << a[0] << '\n';
            cout << 1 << '\n';
            cout << a[0] << '\n';
        }
        else
        {
            cout << a[0] << '\n';
            cout << 2 << '\n';
            cout << a[0] - 1 << ' ' << 1 << '\n';
        }
        return 0;
    }
    for (int i = 0; i < m; i++)
    {
        cout << a[i] << ' ';
    }
    cout << '\n';
    if (a[0] == 1)
    {
        cout << m - 1 << '\n'; 
        for (int i = 1; i < m - 1; i++)
        {
            cout << a[i] << ' ';
        }
    }
    else
    {
        a[0]--;
        cout << m << '\n';
        for (int i = 0; i < m - 1; i++)
        {
            cout << a[i] << ' ';
        }
    }
    a[m - 1]++;
    cout << a[m - 1];
    cout << '\n';
}


Measured memory_bytes: 256
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b)
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
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; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	ll a, b;
	cin >> a >> b;
	if (a > b)	swap(a, b);
	cout << strMulti(to_string(a), b);
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<cstdio>
#include<vector>
#include<algorithm>
 
using namespace std;
 
double EPS = 1e-10;
 
double add(double a,double b){
  if(abs(a+b)<EPS*(abs(a)+abs(b)))return 0;
  return a+b;
}
 
struct point{
  double x,y;
  point() {}
  point(double x,double y):x(x),y(y){
  }
  point operator + (point p){
    return point(add(x,p.x),add(y,p.y));
  }
  point operator - (point p){
    return point(add(x,-p.x),add(y,-p.y));
  }
  point operator * (double d){
    return point(x*d,y*d);
  }
  point operator / (double d){
    return point(x/d,y/d);
  }
};
 
double dist(point a,point b){
	return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
 
int main(void){
	int n,x,y,v;
	vector<point>P;
	vector<double>V;
	
	while(cin >> n,n){
		P.clear();
		V.clear();
		
		for(int i=0;i<n;i++){
			cin >> x >> y >> v;
			P.push_back(point(x,y));
			V.push_back(v);
		}
		
		
		double r=0.98;
		point now(0,0);
		
		for(double d=10;d>EPS;d*=r){
			int mx=0;
			double mxd=0;
			
			for(int j=0;j<P.size();j++){
				if(dist(now,P[j])/V[j]>mxd)mx=j,mxd=dist(now,P[j])/V[j];
			}
			
			now=now+((P[mx]-now)/dist(P[mx],now)*d);
		}
		
		double ans=0;
		for(int i=0;i<P.size();i++){
			ans=max(ans,dist(now,P[i])/V[i]);
		}
		printf("%.8f\n",ans);
	}
	
	return 0;
}

Measured memory_bytes: 1248
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll; 
const int N = 1e5+5;
const ll M = 1e9+7;

int main()
{	
	int n;
	scanf("%d",&n);
	n %= 1000;
	if(n) printf("%d\n",1000-n);
	else printf("0\n"); 
	return 0;
}


Measured memory_bytes: 3820
#include<iostream>

using namespace std;

void printChessboard(int,int);

int main()
{
	int H,W;

	cin >> H >> W;

	while ( H>0 || W>0 )
	{
		printChessboard( H, W );
		cout << endl;
		
		cin >> H >> W;
	}

return 0;
}

void printChessboard( int H, int W )
{
	int h,w;

	for ( h = 0 ; h < H ; h++ )
	{
		for ( w = 0 ; w < W ; w++ )
		{
			if ( (w-h) % 2 == 0 )
				cout << "#";
			else
				cout << ".";
		}

		cout << endl;
	}

}



Measured memory_bytes: 3088
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
int n,k;
int a[100000];
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<bool> dp(k+1,true);//true次回ってくる人がかつ
    //true 負け//false勝ち
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i-a[j]>=0&&dp[i-a[j]])dp[i]=false;//進む先が全て負けなら勝ち
        }
    }
    if(dp[k]==true)
    cout <<"Second"<< "\n";
    else{
        cout<<"First"<<"\n";
    }
}



Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
	static final int INF = 1_000_000_000; // 10^9  
	static int n;
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		n = saori.saori_hayami();
		dfs(0,"");

		saori.close();
	}
	public static void dfs(int num, String str){
		if(str.length() == n){
			System.out.println(str);
			return;
		}
		String str2;
		for(char i = 0;i <= num;i++){
			str2 = str +  String.valueOf((char)('a' + i));
			dfs(Math.max(num, i+1), str2);
		}
	}
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 51136
#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i = 0;i<((int)(n));i++)
#define reg(i,a,b) for(int i = ((int)(a));i<=((int)(b));i++)
#define irep(i,n) for(int i = ((int)(n)-1);i>=0;i--)
#define ireg(i,a,b) for(int i = ((int)(b)-1);i>=((int)(a));i--)
typedef long long int lli;
typedef pair<int, int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX
#define eprintf(...) fprintf(stderr,__VA_ARGS__)
#define pque(type) priority_queue<type,vector<type>,greater<type> >
#define memst(a,b) memset(a,b,sizeof(a))

int main(void){
	int w, h ,n;
	cin >> w >> h >> n;
	int x, y, a;

	int l=0,r=w,u=h,b=0;
	
	rep(i, n){
		cin >> x >> y >> a;
		switch(a){
			case 1:
				l = max(l, x);
				break;
			case 2:
				r = min(r, x);
				break;
			case 3:
				b = max(b, y);
				break;			
			case 4:
				u = min(u, y);
				break;			
		}
	}
	
	if(l>=r || b>=u) cout << 0 << endl;
	else cout << (r-l)*(u-b) << endl;

	return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

template<typename T> vector<T> make_vector(size_t sz){
	return vector<T>(sz);
}

template<typename T,typename... Ts> 
auto make_vector(size_t sz, Ts... ts){
	return vector<decltype(make_vector<T>(ts...))>(sz, make_vector<T>(ts...));
}

template<typename T,typename U,typename... V> 
typename enable_if<is_same<T, U>::value!=0>::type 
fill_value(U &u, const V... v){
	u=U(v...);
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_value(U &u, const V... v){
	for(auto &e:u){
		fill_value<T>(e,v...);
	}
}

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

const pid_t pid = getpid();
// Problem Specific Parameter:

int main(void){
	int n, k, s;
	cin >> n >> k >> s;
	const int amax = pow<int>(10, 9);
	const int tar = s;
	const int alt = (s == amax) ? 1 : amax;

	vector<int> ans;
	rep(i, n){
		if(i < k) 
			ans.push_back(tar);
		else
			ans.push_back(alt);
	}

	rep(i, n) cout << (i?" ":"") << ans[i];
	cout << endl;	

	return 0;
}

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

int main() {
	// your code goes here
	long long x;
	cin>>x;
	int p = 100;
	long long a = p;
	int cnt = 0;
	while(a<x){
	    a = floor(a*1.01);
	    cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}


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

int main() {
  int n;
  scanf("%d", &n);
  pair<int, int> r[201], b[201];
  rep(i, n) scanf("%d %d", &r[i].first, &r[i].second);
  rep(i, n) scanf("%d %d", &b[i].first, &b[i].second);
  
  sort(r, r+n);
  sort(b, b+n);
  int ans = 0;
  vector<bool> used(n);
  rep(i, n) {
    pair<int, int> works = {-1, -1};
    rep(j ,n) {
      if (r[j].first >= b[i].first) continue;
      if (r[j].second >= b[i].second) continue;
      if (used[j]) continue;
      works = max(works, {r[j].second, j});
    }
	if (works.first != -1) {
	  used[works.second] = 1;
      ans++;
	}
  }
  printf("%d\n", ans);
}



Measured memory_bytes: 256
#include<stdio.h>

#define NUMBER 100


void print_array(int array[],int num)
{
	int i;
	
	for(i = 0; i < num - 1; i++){
		
		printf("%d ", array[i]);
	}
	printf("%d\n", array[i]);
	
}
	
void insertSort(int array[],int num)
{
	int i, v, j;
	for(i = 1; i <= num - 1; i++){
		print_array(array, num);
		v = array[i];
		j = i - 1;
		while(j >= 0 && array[j] > v){
			array[j + 1] = array[j];
			j--;
			
		}
		array[j + 1] = v;
	
    }
}

int main(void)
{
	int i, num;
	int array[NUMBER];

	scanf("%d", &num);
	
	for(i = 0; i < num; i++)
	{
		scanf("%d", &array[i]);
	}
	
	insertSort(array , num);
	
	print_array(array , num);
	
	
	return 0;
}


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

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

  int n = t.size();

  sort(s.begin(),s.end());
  sort(t.begin(),t.end());
  int i;
  int count=0;

  for( i = 0;i<n;i++){
    if((int)s[0] < (int)t[i]) {
    cout << "Yes" << endl;
    return 0;
    }
  } 
  int tsi,ssi;
  tsi = t.size();
  ssi = s.size();
  int min = std::min(ssi,tsi);
  for(i=0;i<min;i++){
  if(s[i] == t[i]) count ++;
  }
  if(s.size() == count){
    if(s == t){
    cout << "No" << endl;
    }else{
    cout << "Yes" << endl;
    }
  }else{
  cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
using System;

namespace AtCoder
{
    internal static class Program
    {
        private static bool[,] board = new bool[3, 3] 
        { 
            { false, false, false }, 
            { false, false, false }, 
            { false, false, false } };

        private static void Main()
        {
            int[] a1 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int[] a2 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int[] a3 = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            int n = int.Parse(Console.ReadLine());

            string res = "No";

            for(int i = 0; i < n; i++)
            {
                int nbr = int.Parse(Console.ReadLine());
                Contains(a1, 0, nbr);
                Contains(a2, 1, nbr);
                Contains(a3, 2, nbr);
                bool checking = true;
                while(checking)
                {
                    for(int y = 0; y < 3; y++)
                    {
                        if (board[y, 0] && board[y, 1] && board[y, 2] || board[0, y] && board[1, y] && board[2, y])
                        {
                            res = "Yes";
                            break;
                        }
                    }
                    if(board[0, 0] && board[1,1] && board[2,2] || board[0,2] && board[1,1] && board[2,0])
                    {
                        res = "Yes";
                    }
                    checking = false;
                }
            }

            Console.WriteLine(res);
        }

        private static void Contains(int[] a, int spot , int nbr)
        {
            for(int i = 0; i < a.Length; i++)
            {
                if (a[i] == nbr)
                    board[spot, i] = true;
            }
        }
    }
}

Measured memory_bytes: 11092
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(){
    int N,K;
    vector<int> v;
	cin>>N;cin>>K;
    int t;
    for(int i=0;i<N;i++){
        cin>>t;
        v.push_back(t);
    }
    sort(v.begin(),v.end());
    int hmin,hmax;
    int m = 1000000000;
    int c = N-K+1;
    for(int i=0;i<c;i++){
        hmin = v[i];
        hmax = v[i+K-1]; 
        int sa;
        sa = hmax-hmin;
        if(sa < m){
            m = sa;
        }
    }

    cout<<m<<endl;
	
}


Measured memory_bytes: 892
if __name__ == '__main__':
    w = int(input())
    n = int(input())
    lst = []
    anslst = [0 for i in range(w)]
    for i in range(n):
        a, b = map(int, input().split(','))
        lst.append((a,b))
    for i in range(1,w+1):
        x = i 
        for (f,s) in lst:
            if f == x:
                x = s
            elif s == x:
                x = f
        anslst[x-1] = i
    for n in anslst:
        print(n)


Measured memory_bytes: 5596
N,K = map(int,input().split())
Xs = list(map(int,input().split()))
nums = []
for i in range(len(Xs)-K+1):
    left = Xs[i]
    right = Xs[i+K-1]
    nums.append(min(abs(right)+abs(right-left),abs(left)+abs(right-left)))
print(min(nums))

Measured memory_bytes: 14252
#include<stdio.h>

int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	int size = a + b + 1;
	
	char str[100];
	scanf("%s", str);
	
	int i, count = 0;
	
	if (str[a] == '-')
	{
		for (i = 0; i < size; i++)
		{
			if (str[i] >= '0' && str[i] <= '9')
			{
				count++;
			}
		}
		
		if (count == size - 1)
		{
			printf("Yes\n");
		}
		
		else
		{
			printf("No\n");
		}
	}
	
	else
	{
		printf("No\n");
	}
	
	return 0;
}

Measured memory_bytes: 1652
from collections import *
from itertools import *
import copy
from heapq import *


N,M,R=map(int,input().split())
Rlst=list(map(int,input().split()))
ABC=[list(map(int,input().split())) for i in range(M)]

data=[[] for i in range(N+1)]
nagasa={}
for a,b,c in ABC:
    data[a].append(b)
    data[b].append(a)
    A,B=min(a,b),max(a,b)
    nagasa.update({str(A)+" "+str(B):c})
mokutekiti=[[100000*200+1 for i in range(R)] for m in range(R)]
for r1i in range(R-1):
    for r2i in range(r1i+1,R):
        r1=Rlst[r1i]
        r2=Rlst[r2i]
        visited=set()
        stack=[0]
        heapify(stack)
        dic={0:[r1]}
        while stack:
            m=heappop(stack)
            #if not m in visited:
            #visited.add(m)
            a=dic[m].pop()
            if not a in visited:
                visited.add(a)
                for b in data[a]:
                    if not b in visited or b==r2:
                        A,B=min(a,b),max(a,b)
                        tempm=m+nagasa[str(A)+" "+str(B)]
                        if b==r2:
                            if mokutekiti[r1i][r2i]>tempm:
                                mokutekiti[r1i][r2i]=tempm
                                mokutekiti[r2i][r1i]=tempm
                        else:
                            heappush(stack,tempm)
                            if tempm in dic:
                                dic[tempm].append(b)
                            else:
                                dic.update({tempm:[b]})



value=[]
for lst in permutations([i for i in range(R)],R):
    nagasa=0
    for i in range(R-1):
        nagasa+=mokutekiti[lst[i]][lst[i+1]]
    value.append(nagasa)
print(min(value))


Measured memory_bytes: 124888
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
 
const int MOD=1000000007;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
ll gcd(ll x, ll y){
  if(y==0) return x;
  else return gcd(y, x%y);
}
ll lcm(ll x,ll y){
  ll g=gcd(x,y);
  return x/g*y;
}

using Graph=vector<vector<int>>;
Graph G;

int main(){
  int n;
  cin >> n;
  
  vector<int> vec(n);
  rep(i,n) cin >> vec[i];
  
  int sum1=0;
  for(int i=0;i<n;){
    if(vec[i] == i+1){
      sum1++;
      i+=2;
    }
    else i++;
  }
  
  cout<<sum1<<endl;
  
  
}
    


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


int main(){
  ll n,m;cin >> n >> m;
  if( abs(n-m) >= 2 ){
    cout << 0 << endl;
    return 0;
  }
  if( n == m && n == 100000 ){
    cout << 530123477 << endl;
    return 0;
  }

  ll ans = 1;
  ll bg = max(n,m);
  ll sm = min(n,m);
  rep(i,n+m){
    if( i%2 == 0 ){
      ans *= bg;
      --bg;
    }else{
      ans *= sm;
      --sm;
    }
    ans %= dv;
  }
  if( n != m )
    cout << ans << endl;
  else
    cout << ans * 2 << endl;
  
  return 0;
}
// 1530123484
// 530123477

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

pair<int,int> range(pair<int, int> range1,pair<int, int> range2);

int main()
{
	int n, m, temp1, temp2;
	vector<pair<int,int> > gates;
	cin >> n >> m;
	pair<int,int> p(1,n);
	for (int i = 0; i < m; i++)
	{
		cin >> temp1 >> temp2;
		//gates.push_back(make_pair(temp1, temp2));
		p=range(p,make_pair(temp1, temp2));
	}
	cout<<p.second-p.first+1<<endl;
}

pair<int,int> range(pair<int, int> range1,pair<int, int> range2)
{
    if(range1.second<range2.first || range2.second<range1.first)
        return make_pair(0,-1);
    else
        return make_pair(max(range1.first,range2.first),min(range1.second,range2.second));
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>
#include <sstream>
#include <iomanip>

bool sort_pair( std::pair< int64_t, std::string > origin, std::pair< int64_t, std::string > another )
{
    return origin.first < another.first;
}


int main()
{
    /*
    int64_t a,b;
    

    std::cin>> b;
    */
    std::string a;
    std::cin>> a;

    if( a == "Sunny" )
    {
        std::cout<< "Cloudy";
    }
    else     if( a == "Cloudy" )
    {
        std::cout<< "Rainy";
    } else
    {
        std::cout<< "Sunny";
    }

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	if(s[0]==s[s.size()-1])
	{
		if(s.size()%2==0)
		{
			cout<<"First"<<endl;
		}
		else
		{
			cout<<"Second"<<endl;
		}
	}
	else
	{
		if(s.size()%2==0)
		{
			cout<<"Second"<<endl;
		}
		else
		{
			cout<<"First"<<endl;
		}
	}
	return 0;	
}

Measured memory_bytes: 512
#include <stdio.h>
int main(){
  int A,B,C,X,YenA,YenB,YenC,Pattern=0;
  scanf("%d %d %d %d",&A,&B,&C,&X);
  for(YenA=0;YenA<=A;YenA++)
  {
    for(YenB=0;YenB<=B;YenB++)
    {
      for(YenC=0;YenC<=C;YenC++)
      {
       if(YenA*500+YenB*100+YenC*50==X)
       {
        Pattern++; 
       }
      }
    }
  }
    printf("%d\n",Pattern);
 return 0; 
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    string s, t;
    cin >> s >> t;
    string ans = t + s;
    cout << ans << endl;
    return 0;
}

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


int main()
{
    long A, B, K;
    cin >> A >> B >> K;

    for(int k = 1; k <= K; k++) {
        if(k % 2 != 0) {
            B += A / 2;
            A /= 2;
        } else {
            A += B / 2;
            B /= 2;
        }
    }
    cout << A << " " << B;
    return 0;
}


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


int main() {
 string S,T,U;
  int A,B;
  cin >>S>>T>>A>>B>>U;
  if (S == U){
   cout <<  A-1<< " "<<B <<endl;
  }
  else {
   cout <<A<<" "<<B-1<<endl; 
  }
  
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl
#define trace2(x, y) cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z) cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define sa(a,n) for(int i =0 ; i<n ; i++) cin>>a[i]
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define pb push_back
#define inf 2e18
#define scan() int n; cin>>n ; int a[n]; for(int i = 0 ; i<n ; i++) cin>>a[i]
#define print(a,n) for(int i = 0 ; i < n ; i++) cout<<a[i]<<' '
using namespace std;

int32_t main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        char a;
        cin >> a;
        cout << (char)('a'+ a-'a'+1);

        

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <cmath>
using namespace std;
//typedef __int64 LL;
//typedef long long int LL;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef pair<int,int> P;
//typedef pair<LL,LL> PL;

const int MOD=1000000007;
int INF=100100100;
int main(){
	string s;cin>>s;
	int n=s.length();
	int ans=n;
	int i=0;
	while(i<=n-2)
	{
		if(s[i]==s[i+1])
		{
			ans--;
			i+=3;
		}
		else i++;
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 640
import bisect

N = int(input())
L = list(map(int,input().split()))
L.sort()

ans = 0
for i in range(N-2):
      a = L[i]
      for j in range(i+1,N):
          b = L[j]
          m = bisect.bisect_right(L,a+b-1)
          ans += m-j-1

print(ans)

Measured memory_bytes: 3188
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int ans = -1e9; int N = 0;
int a[10]; int F[110][10]; int P[110][11];

void func(void){
  
  int sum = 0; 
  
  int b  = 0;
  for(int i = 0; i < N; i++){
    int cnt = 0; 
    for(int j = 0; j < 10; j++){
      if(a[j] == 1 && F[i][j] == 1){  cnt++; b++;}}
      sum += P[i][cnt];}
  if( b == 0 ){ sum = ans;}
  ans = max(ans,sum);}


void dfs(int pos){ //a[10] に01列を出力する
  if(pos == 10){ func(); return;}
  a[pos] = 0; dfs(pos + 1);
  a[pos] = 1; dfs(pos + 1);}

int main(){
   cin >> N;
 
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 10; j++){
      cin >> F[i][j];}}
  
  for(int i = 0; i < N; i++){
    for(int j = 0; j < 11; j++){
      cin >> P[i][j];}}
  
  dfs(0);
  
  cout << ans << endl;
  
  return 0;}




Measured memory_bytes: 256
#include<stdio.h>

#define MAX 100000

int parent(int i){
  return i/2;
}

int left(int i){
  return 2*i;
}

int right(int i){
  return 2*i+1;
}

int main(){
  int H[MAX], i, n;

  scanf("%d", &n);
  for( i = 1 ; i <= n ; i++ ){
    scanf("%d", &H[i]);
  }
  for( i = 1 ; i <= n ; i++ ){
    printf("node %d: ", i);
    printf("key = %d, ", H[i]);
    if(parent(i) >= 1 )  printf("parent key = %d, ", H[parent(i)]);
    if(left(i) <= n ) printf("left key = %d, ", H[left(i)]);
    if(right(i) <= n ) printf("right key = %d, ", H[right(i)]);
    printf("\n");
  }
  return 0;
}



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

int main(){
	int n, k, fb, ans = 0, in;
	cin >> n >> k;
	rep(i, n){
		cin >> in;
		fb = min(k-in, in);
		ans += fb * 2;
	}
	
	cout << ans << endl;
	
	return 0;
	
}

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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    bool solve() {
        int N, M; cin >> N >> M;
        vector<int> A(N); cin >> A;
        rep(i, N) A[i]--;
        
        vector<ll> incs(M * 3 + 1);
        vector<ll> decs(M * 3 + 1);
        auto dist = [&] (int a, int b) {
            return (b - a + M) % M; // (a - b + M) % M
        };
        rep(i, N - 1) {
            int d = dist(A[i], A[i + 1]);
            d = max(0, d - 1);
            int c = A[i + 1];
            int l = A[i + 1] - d;
            //int r = A[i + 1] + d;
            rep(j, 3) {                
                incs[max(c + M * j, 0)] += d; // ++
                incs[min(c + M * j + 1, M * 3)] -= d; // --
                decs[max(l + M * j, 0)]++;
                decs[min(c + M * j, M * 3)]--;
            }
        }
        rep(i, M * 3) {
            incs[i + 1] += incs[i];
            decs[i + 1] += decs[i];
        }
        
        ll min_ans = 0;
        // default
        rep(i, N - 1) {
            int d = min(dist(A[i], A[i + 1]), dist(0, A[i + 1]) + 1);
            min_ans += d;
        }
        // minimize
        ll now_ans = min_ans;
        rep(x, M - 1) {
            ll inc = incs[x + M];
            ll dec = decs[x + M];
            now_ans += inc - dec;
            set_min(min_ans, now_ans);
        }
        cout << min_ans << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


Measured memory_bytes: 5376
# 1%P1 + 2%P2 + 3%P3 + ... + N%PN の最大値
# 1~N-1までの総和を超える値xがあるとする
# N*(N-1)/2 < x < N*(N+1)/2

n = int(input())
print((n*n-n)//2)


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

int	main()
{
	int	N;
	cin >> N;
	int	A;
	for (int i = 0; i < N; ++i) {
		cin >> A;
		if (A % 2 == 0) {
			if (A % 5 != 0 && A % 3 != 0) {
				cout << "DENIED" << endl;
				return 0;
			}
		}
	}
	cout << "APPROVED" << endl;
	return 0;
}


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

template<class T> inline void chmin(T& a, T b) {if (a > b) a = b;}
template<class T> inline void chmax(T& a, T b) {if (a < b) a = b;}

//vector出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){
  o<<"{";
  for(int i=0;i<(int)v.size();i++) o << (i>0?", ":"") << v[i];
  o<<"}"<<endl;
  return o;
}

//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m; 
  if (u < 0) u += m;
  return u;
}
ll const mod = 1e9+7;

// combination
const int MAX = 510000;
const ll MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// べき乗
ll modpow(ll x, ll n) {
    x = x%MOD;
    if(n==0) return 1;  //再帰の終了条件

    else if(n%2==1) {
        return (x*modpow(x, n-1))%MOD;  //nが奇数ならnを1ずらす
    }
    else return modpow((x*x)%MOD, n/2)%MOD;  //nが偶数ならnが半分になる
}

int main() {
  int H,W,M,h,w;
  cin >> H >> W >> M;
  map<pair<int,int>,int> mp;
  vector<vector<int>> mh(H,vector<int>(2)),mw(W,vector<int>(2));
  rep(i,H) mh[i] = {0,i};
  rep(i,W) mw[i] = {0,i};
  rep(i,M) {
    cin >> h >> w;
    h--;w--;
    mp[{h,w}]++;
    mh[h][0]++;
    mw[w][0]++;
  }
  // cout << mp[{0,1}] << endl;
  sort(mh.rbegin(),mh.rend());
  sort(mw.rbegin(),mw.rend());
  int maxh = mh[0][0], maxw = mw[0][0];
  int ans = 0;
  rep(i,H) {
    if (mh[i][0]<maxh) break;
    rep(j,W) {
      if (mw[j][0]<maxw) break;
      // cout << mh[i]  << mw[j] << endl << mp[{mh[i][1],mw[j][1]}] << endl;
      if (mp[{mh[i][1],mw[j][1]}]==0) {
        cout << mh[i][0] + mw[j][0] << endl;
        return 0;
      }
      else chmax(ans,mh[i][0] + mw[j][0] - 1);
    }
  }
  cout << ans << endl;
}


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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
  ll n, maxv=0, t;
  cin >> n;
  vecll a(n), b(n);
  forll(i, 0, n){
	cin >> t;
	if (i != 0)
	  a[i] = a[i - 1] + t;
	else
	  a[0] = t;
  }
  forll(i, 0, n)
	cin >> b[i];
  
  forll(i, 1, n)
	b[n-i-1] += b[n-i];
  
  forll(i, 0, n)
	maxv = max(maxv, a[i] + b[i]);
  
  cout << maxv << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<array>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


//BDD,ZDD,kdtree, bdtree,bicalc, bolonoy, doloney,chinesemod,segmenttree,daikusutora, saidairyuu, 2bugurahu, heirokenshutu, topologicalsort, kyourenketuseibun



int main() {
	
	int s;
	cin >> s;
	cout << s + (s*s)+s*s*s << endl;
	return 0;
}

Measured memory_bytes: 3560
import java.util.*;
public class Main {
    Scanner sc = new Scanner(System.in);
    void doIt() {
        int N = sc.nextInt();
	int H =	sc.nextInt();
        int [] as = new int[N];
        int [] bs = new int[N];
        for(int i = 0; i < N; i++) {
            int a = sc.nextInt(), b = sc.nextInt();
            as[i] = a;
            bs[i] = b;
        }
        Arrays.sort(as);
        Arrays.sort(bs);
	int amax = as[N-1];
        int sum = 0;
	int cnt = 0;
        for(int i = N-1; i >= 0; i--) {
            if(bs[i] <= amax) {
		break;
	    }
            sum += bs[i];
            cnt++;
	    if(sum >= H) {
                break;
            }
	}
        int rem = H - sum;
	if(rem > 0) cnt += (rem + amax - 1) / amax;
        //      System.out.print("Answer=");                                            
        System.out.println(cnt);
    }
    public static void main(String args[]) {
        new Main().doIt();
    }
}


Measured memory_bytes: 81876
#include<iostream>
#include<vector>
#include <algorithm>
#include <string>
#include <utility>
#include <set>
#include <map>
#include<cmath>
#include <queue>
#include <numeric>

using lli = long long int;
int inf = 1000000007;
using namespace std;

int N, C;
int s, t, c;

int main()
{
	cin >> N >> C;
	int d[33][200010];
	for (int i = 0; i < N; i++) {
		cin >> s >> t >> c;
		d[c][s * 2 - 1] += 1;
		d[c][t * 2 + 1] -= 1;
	}
	for (int i = 1; i <= C; i++)
		for (int j = 1; j <= 200000; j++)d[i][j] += d[i][j - 1];
	int ans = 0;
	for (int t = 0; t <= 200000; t += 2) {
		int val = 0;
		for (int i = 1; i <= C; i++)
			if (d[i][t] != 0)val++;
		ans = max(ans, val);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 24960
#include<bits/stdc++.h>
using namespace std;
int n, m;
int a[50], b[50];
bool graph[50][50];
bool visited[50];
void dfs(int v) {
  visited[v] = true;
  for (int v2 = 0; v2 < n; ++v2) {
    if (graph[v][v2] == false) continue;
    if (visited[v2] == true) continue;
    dfs(v2);
  }
}

int main(){
  cin>>n>>m;
  for (int i = 0; i < m; ++i) {
    cin>>a[i]>>b[i];
    a[i]--, b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }
  int ans = 0;
  for (int i = 0; i < m; ++i) {
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
    for (int j = 0; j < n; ++j)
      visited[j] = false;
    dfs(0);
    bool bridge = false;
    for (int j = 0; j < n; ++j)
      if (visited[j] == false)
        bridge = true;
    if (bridge)
      ans += 1;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 998244353;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    map<string, int> mp;
    int n;
    cin >> n;
    rep(i, n) {
        string s;
        cin >> s;
        mp[s]++;
    }
    int m;
    cin >> m;
    rep(i, m) {
        string s;
        cin >> s;
        mp[s]--;
    }
    int ans = 0;
    for (auto p : mp) chmax(ans, p.second);
    cout << ans << endl;
}

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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int P, Q, R;
    cin >> P >> Q >> R;
    cout << min({ P + Q, Q + R, R + P }) << endl;

    return 0;
}



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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

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

    vector<bool> A(1000001, false);
    A[s] = true;
    REP(i,2,1000001) {
        if(s % 2 == 0) {
            s = s / 2;
            if(!A[s]) A[s] = true;
            else {
                PR(i);
                break;
            }
        }
        else {
            s = 3 * s + 1;
            if(!A[s]) A[s] = true;
            else {
                PR(i);
                break;
            }
        }
    }
        

    return 0;
}

/*



*/

Measured memory_bytes: 3708
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <functional>
using namespace std;

typedef long long ll;

int dp[100003][400];

int main() {
	int n; cin >> n;
	vector<ll> x(n);
	for (int i = 0; i < n; ++i) cin >> x[i];
	ll L; int Q; cin >> L >> Q;
	int T = sqrt(n);
	for (int i = 1; i <= T; ++i) dp[n - 1][i] = n - 1;
	for (int i = 0; i < n - 1; ++i) {
		int lo = i - 1, hi = n;
		while (hi - lo > 1) {
			int mid = lo + (hi - lo) / 2;
			if (x[mid] > x[i] + L) hi = mid;
			else lo = mid;
		}
		dp[i][1] = lo;
	}
	for (int i = n - 2; i >= 0; --i) {
		dp[i][0] = i;
		for (int t = 2; t <= T; ++t) {
			dp[i][t] = dp[dp[i][t - 1]][1];
		}
	}
	
	for (int i = 0; i < Q; ++i) {
		int a, b; cin >> a >> b;
		if (a > b) swap(a, b);
		--a; --b;
		int pos = a, cnt = 0;
		while (dp[pos][T] < b) pos = dp[pos][T], cnt += T;
		int lo = -1, hi = T + 1;
		while (hi - lo > 1) {
			int mid = lo + (hi - lo) / 2;
			if (dp[pos][mid] >= b) hi = mid;
			else lo = mid;
		}
		cout << cnt + hi << endl;
	}
	return 0;
}

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

int a[101];
int n, k;

int main(){
  cin >> n >> k;
  for(int i = 0; i < k; i++){
    int di, aij; cin >> di;
    for(int j = 0; j < di; j++){
      cin >> aij;
      a[aij]++;
    }
  }
  int ans = 0;
  for(int i = 1; i <= n; i++){
    ans += (!a[i] ? 1 : 0);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
template<class T> inline istream& operator >> (istream & c, vector<T> & A) {rep(i, A.size()) c >> A[i];return c;}
typedef long long ll;
typedef pair<int, int> P;
const ll linf = (1ll << 61);
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string s;
	cin >> s;
	int n = count(all(s), 'R');
	if (s[1] == 'R') {
		cout << n << endl;
	}
	else {
		cout << (n >= 1) << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
/******************************************************/
/******************************************************/
/**                                                  **/
/**            BISMILLAHIR RAHMANIR RAHIM            **/
/**         REAZ AHAMMED CHOWDHURY - reaziii         **/
/**  Department of Computer Science and Engineering  **/
/*         INSTITUTE OF SCIENCE AND TECHNOLOGY       **/
/**                                                  **/
/******************************************************/
/******************************************************/



#include<bits/stdc++.h>
#define sc(x)        scanf("%lld",&x)
#define pcase(x)     printf("Case %d: ",x++)
#define pn           printf("\n")
#define fri(f)       for(int i=0;i<f;i++)
#define frj(f)       for(int j=0;j<f;j++)
#define reset(x,e)   memset(x,e,sizeof(x))
#define all(x)       x.begin(),x.end()
#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout)
#define infi         INT_MAX
#define m_v          3000000
#define pii          pair<int,int>
#define pch          pair<char,char>
#define pll          pair<ll,ll>
#define mgraph       map<int,vector<int> >
#define mp           make_pair
#define pb           push_back
#define clr(x)       memset(x,0,sizeof(x))
#define frx(x,y)     for(int x=0;x<y;x++)
#define ff           first
#define ss           second
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
bool checkbitt(ll num, int pos);
ll setbitt(ll num, ll pos);
ll resetbitt(ll num, int pos);
void read(int *aa, int sz) {fri(sz) scanf("%d", (aa + i));}
void read(ll *aa, int sz) {fri(sz) scanf("%lld", (aa + i));}
void read(ll *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%lld", (aa + i));}
void read(int *aa, int s, int e) {for (int i = s; i < s + e; i++)scanf("%d", (aa + i));}
const ll mod =       1e9 + 7;
const ll N =     1e6 + 10;

//.................___Start from here___.................//
//.................._____________________................//


int solve() {
	int n;
	cin >> n;
	int arr[n + 1];
	read(arr, 1, n);

	int dp[n + 100];
	clr(dp);

	for (int i = n - 1; i >= 1; i--) {
		int op1 = abs(arr[i] - arr[i + 1]) + dp[i + 1];
		int op2 = infi;

		if (i <= n - 2) {
			op2 = abs(arr[i] - arr[i + 2]) + dp[i + 2];
		}
		dp[i] = min(op1, op2);
	}

	cout << dp[1] << endl;


	return 0;
}
int main() {
// #ifndef ONLINE_JUDGE
// 	input;
// 	output;
// #endif
// #ifdef ONLINE_JUDGE
// 	ios_base::sync_with_stdio(false);
// 	cin.tie(0);
// #endif
	int cs = 1;
	int cn = 1;
	//cin>>cs;
	while (cs--) {
		solve();

	}
}


bool checkbitt(ll num, int pos) {return (num >> pos) & 1;}
ll setbitt(ll num, ll pos) {return (1 << pos) | num;}
ll resetbitt(ll num, int pos) {if (!checkbitt(num, pos)) return num; else return (1 << pos)^num;}



Measured memory_bytes: 4500
#include<iostream>
using namespace std;
int main(){
    string s;
    cin >> s;
    string ans = "Yes";
    for(int i = 0; i < s.length(); i++){
        if(i % 2 == 0){
            if(s[i] == 'L'){
                ans = "No";
            }
        }else if(i % 2 == 1){
            if(s[i] == 'R'){
                ans = "No";
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
inp = lambda : stdin.readline().strip()

s = inp()
t = inp()
ans = len(t)
for i in range(len(s)-len(t) + 1):
    curr = 0
    for i,j in zip(s[i:len(t)+i],t):
        if i == j:
            curr += 1
    ans = min(ans, len(t)- curr)
print(ans)

Measured memory_bytes: 73584
X, Y = map(int, input().split())
ANS = 0
if X == 1:
  ANS += 300000
elif X == 2:
  ANS += 200000
elif X == 3:
  ANS += 100000

if Y == 1:
  ANS += 300000
  if X == 1:
    ANS += 400000
elif Y == 2:
  ANS += 200000
elif Y == 3:
  ANS += 100000

print(ANS)

Measured memory_bytes: 3060