akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)

int main() {
    string S;
    cin >> S;
    if (S == "ABC") cout << "ARC" << endl;
    else cout << "ABC" << endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll; typedef long double ld;
const int INF32 = 1e9+10;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, A, B; cin >> N >> A >> B;
  int P[110];
  for (int i = 0; i < N; i++)
    cin >> P[i];
  int l=0, m=0, n=0;
  for (int i = 0; i < N; i++) {
    l += (P[i]<=A);
    m += (P[i]>A && P[i] <= B);
    n += (P[i]>B);
  }
  int a[3] = {l, m, n};
  cout << *min_element(a, a+3) << endl;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int n;
    cin >> n;
    cout << Div(n, 2) << endl;
    return 0;
}


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

int main(void){
	int A,B,C;
    cin >> A >> B >> C;
	if((A == 5 && B == 7 && C == 5) || (A == 7 && B == 5 && C == 5) || (A == 5 && B == 5 && C == 7)){
    	cout << "YES";
    }else{
   		cout << "NO"; 
    }
}


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

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

	int a, b, c;
	cin >> a >> b >> c;
	if (a < b && b < c){
		cout << "Yes\n";
	}
	else{
		cout << "No\n";
	}

	return 0;
}


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

using namespace std;

#define F first
#define S second
#define modulo ll (1e9 + 7)

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

void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
}

const int N = 59, M = 5e3 + 9, OO = 0x3f3f3f3f;
const ll llOO = 0x3f3f3f3f3f3f3f3f;


int main(){
    init();

    string a, b, c; cin >> a >> b >> c;
    if(a.back() == b[0] && b.back() == c[0])    cout << "YES";
    else cout << "NO";

}

Measured memory_bytes: 256
while True:
    t, p, r = map(int, input().split())
    if t == p == r == 0:
        break

    data = [[0 for i in range(p + 1)] for i in range(t + 1)]
    for i in range(r):
        li = input().split()
        tid, pid, time = map(int, li[:3])
        if li[3] == "WRONG":
            data[tid][pid] -= 1
        else:
            data[tid][pid] = time - data[tid][pid] * 1200

    rank = list()
    for tid in range(1, t + 1):
        ans, pen = 0, 0
        for pid in range(1, p + 1):
            if data[tid][pid] > 0:
                ans -= 1
                pen += data[tid][pid]
        rank.append((ans, pen, tid))

    for ans, pen, tid in sorted(rank):
        print(tid, -ans, pen)


Measured memory_bytes: 5652
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define Length 35000

void strpro ( char* ) ;

int main ( )
{
	int N ;
	char *str ;
	str = ( char* ) malloc ( Length * sizeof ( char ) ) ;
	while ( scanf ( "%d" , &N ) == 1 && N ) {
		scanf ( "%s" , str ) ;
		for ( int i = 0 ; i < N ; i++ ) {
			strpro ( str ) ;
		}
		puts ( str ) ;
	}
	return 0 ;
}

void strpro ( char *var )
{
	int *iList ;
	char *cList ;
	int len = 0 ;
	int counts = 1 ;
	iList = ( int* ) malloc ( Length * sizeof ( int ) ) ;
	cList = ( char* ) malloc ( Length * sizeof ( char ) ) ;
	for ( char *ptr = var , *cmp = NULL ; true ; ptr++ ) {
		if ( *ptr == '\0' ) {
			iList[len] = counts ;
			cList[len] = *cmp ;
			cList[len + 1] = '\0' ;
			len++ ;
			break ;
		}
		if ( ptr != var && cmp != NULL ) {
			if ( *ptr == *cmp ) {
				counts++ ;
			}
			else {
				iList[len] = counts ;
				cList[len] = *cmp ;
				cList[len + 1] = '\0' ;
				len++ ;
				counts = 1 ;
			}
		}
		cmp = ptr ;
	}
	char *ptr = var ;
	for ( int i = 0 ; cList[i] ; i++ ) {
		char tmp[10] ;
		sprintf ( tmp , "%d" , iList[i] ) ;
		for ( int j = 0 ; tmp[j] ; j++ ) {
			*( ptr++ ) = tmp[j] ;
		}
		*( ptr++ ) = cList[i] ;
	}
	*ptr = NULL ;
}

Measured memory_bytes: 1740
<?php
$numbers = rtrim(fgets(STDIN));
$n = intval($numbers);

$a = [];
for($i = 0; $i < $n; $i++){
    $numbers = preg_split("/[\s,]+/", rtrim(fgets(STDIN)));
    // var_dump($numbers);
    if (intval($numbers[0]) == 0){
        $a[] = $numbers[1];
    } else if (intval($numbers[0]) == 1){
        print $a[intval($numbers[1])];
        print "\n";
    } else {
        array_pop($a);
    }
}


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

int main(){
  char c;
  vector<int> az(26);
  while (cin >> c) {
    if (c >= 'a' && c <= 'z') az[c - 'a'] ++;
    else if (c >= 'A' && c <= 'Z') az[c - 'A'] ++;
  }

  for (int i = 0; i < 26; i ++) {
    cout << (char)('a' + i) << " : " << az[i] << endl;
  }
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FI first
#define SE second
#define endl "\n"
#define ciosup cin.tie(0);ios::sync_with_stdio(false);
#define eb emplace_back
constexpr ll INF = 1e9 + 7;
constexpr ll MOD = 1e9 + 7;

struct UnionFind
{
    vector<int> par, rank;
    UnionFind(int N) : par(N), rank(N)
    {
        REP(i, N)
        {
            par[i] = i;  //the parent of the node
            rank[i] = 0; //the rank of the tree
        }
    }
    int find(int x)
    { //Find the root of x
        if (par[x] == x)
        {
            return x;
        }
        else
        {
            return par[x] = find(par[x]);
        }
    }
    void unite(int x, int y)
    { //Unite (the set of x) and (the set of y)
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (rank[x] < rank[y])
        { //larger rank is above
            par[x] = y;
        }
        else
        {
            par[y] = x;
            if (rank[x] == rank[y])
                rank[x]++;
        }
    }
    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
};

int main()
{
    int n,m;
    cin >> n >> m;
    UnionFind gp(n);
    int x[m], y[m], z[m];
    REP(i,m){
        int a,b,c;
        cin >> a >> b >> c;
        x[i] = a - 1;
        y[i] = b - 1;
        z[i] = c % 2;
    }
    REP(i,m){
        gp.unite(x[i], y[i]);
    }
    set<int> parset;
    REP(i, n){
        parset.insert(gp.find(i));
    }
    cout << parset.size() << endl;
}

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

int main()
{
    string s;
    cin >> s;
    int a = 0,b = 0,i;
    for(i = 0;i < s.size();++i){
        if(i%2){
            if(s.at(i) == '0'){
                ++a;
            }
        }else{
            if(s.at(i) == '1'){
                ++a;
            }
        }
    }
    for(i = 0;i < s.size();++i){
        if(i%2){
            if(s.at(i) == '1'){
                ++b;
            }
        }else{
            if(s.at(i) == '0'){
                ++b;
            }
        }
    }
    cout << min(a,b) << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
long long  n, m, g;
char s[maxn], t[maxn];
map<long long, long long> mp;
void slove()
{
    scanf("%lld %lld" ,&n ,&m);
    g = __gcd(n, m);
	scanf("%s %s" ,s ,t);
	long long len = n * m / g;
	for (long long c = 0; c < n; ++ c)
    {
        mp[1 + c * (len / n )] = (long long)s[c];
    }
    for (long long c = 0; c < m; ++ c)
    {
        long long x = (long long)t[c];
        if (mp[1 + c * (len / m )] != 0 and mp[1 + c * (len / m )] != x)
        {
            puts("-1");
            return ;
        }
    }
    printf("%lld\n" ,len);
    return ;
}
signed main()
{
	slove();
	return 0;
}


Measured memory_bytes: 10880
#include <iostream>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
 
using namespace std;
 
int n, m;
vector<int> vec[15];
int p[15];
 
int main(void)
{
	cin >> n >> m;
	int k, x;
	for(int i = 1; i <= m; i++){
		cin >> k;
		for(int j = 0; j < k; j++){
			cin >> x;
			x--;
			vec[i].push_back(x);
		}
	}
	for(int i = 1; i <= m; i++) cin >> p[i];
	
	int N = 1<<n, ans = 0;
	for(int i = 0; i < N; i++){
		bool flag = true;
		for(int j = 1; j <= m; j++){
			int cnt = 0;
			for(int k = 0; k < vec[j].size(); k++){
				if(i & (1<<vec[j][k]))cnt++;
			}
			if(cnt%2 != p[j]) flag = false;
		}
		if(flag) ans++;
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 3640
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>
#include<queue>

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

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}



int main(){
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < s.size(); i++){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3932
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod = 998244353
INF = 10**18
eps = 10**-7

n,x,m = map(int,readline().split())

if n == 1:
    print(x)
    exit()

if n < 10**7:
    a = [0]*n
    a[0] = x
    for i in range(n-1):
        a[i+1] = a[i]**2%m
    print(sum(a))
    exit()



a = [0]*(m+10)
a[0] = x

for i in range(m+5):
    a[i+1] = a[i]**2%m

idx = [-1]*m

for i in range(m+5):
    if (idx[a[i]] == -1):
        idx[a[i]] = i
    else:
        idxx = idx[a[i]]
        now = i
        break

d = sum(a[idxx:now])
l = now-idxx
ans = sum(a[:idxx])
n -= idxx
ans += d*(n//l)
n = n%l
ans += sum(a[idxx:idxx+n])
print(ans)







Measured memory_bytes: 72372
def main():
    N = int(input())
    A = list(map(int,input().split()))

    L = []
    for i, a in enumerate(A):
        L.append((a, i+1))
    L.sort()

    ans = []
    for l in L:
        ans.append(l[1])
    print(" ".join(map(str, ans)))

if __name__ == '__main__':
    main()

Measured memory_bytes: 25444
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define nn '\n'
#define YES {cout<<"YES"<<'\n';}
#define NO {cout<<"NO"<<'\n';}
#define Yes {cout<<"Yes"<<'\n';}
#define No {cout<<"No"<<'\n';}
#define yes {cout<<"yes"<<'\n';}
#define no {cout<<"no"<<'\n';}
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) {cout << n << '\n';}
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b,c,d; cin >> a >> b >> c >> d;
    int lcm = LCM(c,d);
    //b以下のcでもdでも割り切れない個数
    int bb = b;
    int bc = b/c;
    int bd = b/d;
    int blcm = b/lcm;
    bb = bb - bc - bd + blcm;
    //a未満のcでもdでも割り切れない個数
    int aa = a-1;
    int ac = (a-1)/c;
    int ad = (a-1)/d;
    int alcm = (a-1)/lcm;
    aa = aa - ac - ad + alcm;
    //答え
    out(bb-aa);

    return 0;
}

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

int main() {
	int n;
	cin>>n;
	vector<int> v(n);
	for(int i=0;i<n;i++)cin>>v[i];
	int dp[n+1];
	dp[0]=0;
	dp[1]=abs(v[1]-v[0]);
	for(int i=2;i<n;i++){
		dp[i]=min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	cout<<dp[n-1];
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
using namespace std;
int r[4005]={0},g[4005]={0},b[4005]={0};
int n;
string s;
int main(void){
	cin>>n>>s;
	FORN(i,1,n+1){
		r[i]=r[i-1];
		g[i]=g[i-1];
		b[i]=b[i-1];
		if(s[i-1]=='R')r[i]++;
		else if(s[i-1]=='G')g[i]++;
		else b[i]++;
	}
	/*REP(i,n+1)cout<<r[i]<<' ';
	cout<<endl;
	REP(i,n+1)cout<<g[i]<<' ';
	cout<<endl;
	REP(i,n+1)cout<<b[i]<<' ';
	cout<<endl;*/
	ll ans=0;
	FORN(i,1,n+1){
		FORN(j,i+2,n+1){
//			cout<<i<<' '<<j<<' ';
			if((s[i-1]=='R'&&s[j-1]=='G')||(s[i-1]=='G'&&s[j-1]=='R')){//B
				ans+=b[j]-b[i-1];
//				cout<<b[j]-b[i-1]<<' ';
				if((i+j)%2==0){
					if(s[(i+j)/2-1]=='B'){
						ans--;
//						cout<<"B";
					}
				}
			}
			else if((s[i-1]=='R'&&s[j-1]=='B')||(s[i-1]=='B'&&s[j-1]=='R')){//G
				ans+=g[j]-g[i-1];
//				cout<<g[j]-g[i-1]<<' ';
				if((i+j)%2==0){
					if(s[(i+j)/2-1]=='G'){
						ans--;
//						cout<<"G";
					}
				}
			}
			else if((s[i-1]=='G'&&s[j-1]=='B')||(s[i-1]=='B'&&s[j-1]=='G')){//R
				ans+=r[j]-r[i-1];
//				cout<<r[j]-r[i-1]<<' ';
				if((i+j)%2==0){
					if(s[(i+j)/2-1]=='R'){
						ans--;
//						cout<<"R";
					}
				}
			}
//			cout<<endl;
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define int long long int
#define pll pair<int,int>
#define dbl long double
#define ff first
#define ss second
#define endl "\n"
#define mod 1000000007
#define eps 0.00000001
#define inf 1000000000000000001
#define all(x) (x).begin(),(x).end()
#define size(x) (int)(x).size()
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define popb() pop_back()
#define popf() pop_front()
#define mp(x,y) make_pair((x),(y))
#define vec(dt) vector<dt>
#define vv(dt) vector<vector<dt>>
#define fastio(x) ios_base::sync_with_stdio(x); cin.tie(NULL)
#define init(v,s) memset(v,s,sizeof(v)) 
#define bug(x) cerr<<"LINE: "<<__LINE__<<" || click to see test details "<<#x<<" = "<<x<<endl
#define loop(i,s,n) for(auto i=s;i<n;i++)
using namespace std;



signed main()
{
	fastio(0);
	int n,k;
	cin>>n>>k;
	cout<<min(n%k,abs(k-n%k))<<endl;
	return 0;		
} 

Measured memory_bytes: 256
//              +-- -- --++-- +-In the name of ALLAH-+ --++-- -- --+              \\

#include <bits/stdc++.h>

#define int long long

#define F first
#define S second
#define _sz(x) (int)x.size()

using namespace std ;
using ll = long long ;
using ld = long double ;
using pii = pair <int , int> ;

int n , x , ans ;

inline int get (int a , int b) {
	if (a % b == 0) return (2 * a / b - 1) * b ; 
	if (!b) return 0 ;
	int d = a / b ;
	return d * 2 * b + get(b , a % b) ;
}

int32_t main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0) ;

	cin >> n >> x ;

	ans = n + get(x , n - x) ;

	cout << ans << '\n' ;
}


Measured memory_bytes: 256
N,K=map(int, input().split())
p=[[int(x) for x in input().split()] for _ in range(N)]

xs=[x for x,_ in p]
ys=[y for _,y in p]
q=[(x,y) for x in xs for y in ys]

up=[set() for _ in range(len(q))]
dn=[set() for _ in range(len(q))]

for i in range(len(q)):
	xi,yi=q[i]
	for j in range(len(p)):
		xj,yj=p[j]
		if xj >= xi and yj >= yi:
			up[i].add(j)
		if xj <= xi and yj <= yi:
			dn[i].add(j)

ans=10**999

for i in range(len(q)):
	for j in range(len(q)):
		if len(up[i] & dn[j]) >= K:
			xi,yi=q[i]
			xj,yj=q[j]
			ans=min(ans, abs(xj-xi)*abs(yj-yi))

print(ans)


Measured memory_bytes: 51528
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
    long long int n, m;
    cin >> n >> m;

    vector<long long int> h;
    vector<int> bn;


    int temp;
    for (int i = 0; i < n; i++) {
        cin >> temp;
        h.push_back(temp);
        bn.push_back(1);
    }
    vector<long long int> a;
    vector<long long int> b;
    int ta, tb;
    for (int i = 0; i < m; i++) {
        cin >> ta >> tb;
        a.push_back(ta);
        b.push_back(tb);
    }


    long long int ans = 0;

    for (int i = 0; i < m; i++) {
        if (h[a[i]-1] > h[b[i]-1]) {/////////////////
            bn[b[i]-1] = 0;
        } else if (h[b[i]-1] > h[a[i]-1]) {
            bn[a[i]-1] = 0;
        } else {
            bn[a[i]-1] = 0;
            bn[b[i]-1] = 0;
        }
    }

    for (int i = 0; i < n; i++) {
        if (bn[i] == 1)ans++;
    }

    cout << ans;

    


    return 0;
}

Measured memory_bytes: 7336
from itertools import permutations
n, x = map(int, input().split())
if x == 1 or x == 2 * n - 1:
    print('No')
else:
    print('Yes')
    if n == 2:
        ans = [1, 2, 3]
    else:
        if x == 2:
            ans = [i for i in range(1, x - 1)] \
                  + [i for i in range(x + 3, 2 * n)]
            ans = ans[:n-3] + [x+2, x-1, x, x+1] + ans[n-3:]
        else:
            ans = [i for i in range(1, x - 2)] \
                  + [i for i in range(x + 2, 2 * n)]
            ans = ans[:n-3] + [x-2, x+1, x, x-1] + ans[n-3:]

    for i in range(2 * n - 1):
        print(ans[i])

Measured memory_bytes: 14864
#include<bits/stdc++.h>
using namespace std;
vector<int>v[110][110];
int a[110][110],used[110],wh[110],T,n,m,g[110][110];
inline bool work(int x){
	for(int i=1;i<=n;i++)
	  if(g[x][i]&&used[i]!=T){
	  	used[i]=T;
	  	if(!wh[i]||work(wh[i])){
	  	  wh[i]=x;
	  	  return 1;
		}
	  }
	return 0;
}
inline void go(){
	for(int i=1;i<=n;i++)T++,work(i);
}
int main(){
	int i,j,k;
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++)
	  for(j=1;j<=m;j++){
	    int x;
	    scanf("%d",&x);
	    v[i][(x-1)/m+1].push_back(x);
	  }
	for(i=1;i<=m;i++){
	  T=0;
	  memset(used,0,sizeof(used));
	  memset(wh,0,sizeof(wh));
	  memset(g,0,sizeof(g));
	  for(j=1;j<=n;j++)
	    for(k=1;k<=n;k++)
	      if(!v[j][k].empty())g[j][k]=1;
	  go();
	  for(j=1;j<=n;j++){
	  	k=wh[j];
	  	a[k][i]=v[k][j].back();
	  	v[k][j].pop_back();
	  }
	}
	for(i=1;i<=n;i++){
	  for(j=1;j<=m;j++)printf("%d ",a[i][j]);
	  puts("");
	}
	for(j=1;j<=m;j++)
	  for(i=1;i<=n;i++)
	    for(k=i+1;k<=n;k++)
	      if(a[i][j]>a[k][j])swap(a[i][j],a[k][j]);
	for(i=1;i<=n;i++){
	  for(j=1;j<=m;j++)printf("%d ",a[i][j]);
	  puts("");
	}
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		//???????????????????????????
		int count =0;
		//????????£????????????
		Scanner sc =  new Scanner(System.in);
		while(true){
			//???????????°
			int n = sc.nextInt();
			//???????????????
			int  x = sc.nextInt();
			//??\???????????????????????±0?????£????????????
			if( n==0 && x ==0){
				break;
			}
			//??????????¶???????
			for( int i=1; i<= n; i++){
				for(int j=i+1; j<=n;j++){
					for(int k=j+1;k<=n;k++){
						//??¨???????§£???????????¨?????´????????´???
						if(i+j+k == x){
							count++;
						}
					}
				}
			}
			System.out.println(count);
			//????????????????????????
			count =0;
		}
	}
}

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

int prv[26][200010];
int dp[200010];

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    string S, K; cin >> K;
    rep(i, K.length()) S += K[K.length() - 1 - i];
    //cout << S << endl;
    rep(i, 26) rep(j, 200010) prv[i][j] = 0;
    rep(i, 200010) dp[i] = INF;
    rep(i, S.length()) {
        rep(j, 26) {
            prv[j][i + 2] = prv[j][i + 1];
        }
        prv[S[i] - 'a'][i + 2] = i + 1;
    }
    /*
    rep(i, S.length()) {
        cout << i + 1 << " " << S[i] << " ";
        rep(j, 26) {
            cout << prv[j][i + 1] << " ";
        }
        cout << endl;
    }
    //*/
    dp[0] = 0;
    rep(i, S.length() + 1) {
        rep(j, 26) {
            dp[i + 1] = min(dp[i + 1], dp[prv[j][i + 1]] + 1);
        }
        //cout << i + 1 << " " << dp[i + 1] << endl;
    }
    int i = S.length() + 1;
    //cout << dp[i] << endl;
    string A; 
    while(i > 0){
        rep(j, 26) {
            //cout << "*" << i << " " << dp[i] << " " << prv[j][i] << endl;
            if (dp[i] == dp[prv[j][i]] + 1) {
                A += (char)(j + 'a');
                i = prv[j][i];
                break;
            } else {
                //cout << dp[i] << " " <<  dp[prv[j][i]] << endl;
            }
        }
        //cout << A << endl;
    }
    cout << A << endl;
   


    return 0;
}


Measured memory_bytes: 22036
#include<iostream>

using namespace std;

int main() {
	int w, h, x, y, r;
	cin >> w >> h >> x >> y >> r;
	if (x + r <= w && x - r >= 0 && y + r <= h && y - r >= 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 1156
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    char s[n];
    scanf("%s", s);
    int r = 0; 
    int b = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') r += 1;
        else if(s[i] == 'B') b += 1; 
    }
    printf("%s\n", (r > b) ? "Yes" : "No");
    return 0; 
}

Measured memory_bytes: 128
#include <stdio.h>
int main(void) {
	int A, B, C;
	int count, t = 10;
	scanf("%d", &A);
	scanf("%d", &B);
	scanf("%d", &C);
	for (count = 1; count <= 100000; count++) {
		if ((A*count) % B == C) {
			printf("YES\n");
			break;
		}
	}
	if ((A*count%B != C)) printf("NO\n");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <algorithm>

#define rep(i, N) for(int (i) = 0; (i) < (N); (i) ++)
typedef long long ll;

using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    rep(i, N){
        int a;
        cin >>  a;
    }
    cout << (N - 2) / (K - 1) + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(){
  char s[204];  scanf("%s", s);

  int length = strlen(s)-2;
  while(length >= 0){
    int flag = 1;
    for(int i=0; i<length/2; i++){
      if(s[i] != s[length/2+i]){
	flag = 0;
	break;
      }
      if(i == length/2-1)
	printf("%d\n", length);
    }
    if(flag)  break;
    length -= 2;
  }
  
  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int c[30][50];

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

  REP (i, n) {
    cin >> s;
    int len = s.length();
    REP (j, len) {
      //cout << s[j] << endl;
      //cout << s[j] - 'a' << endl;         
      int num = (int)(s[j] - 'a');
      c[num][i]++;
    }
  }

  REP (i, 30) {
    int minnum = 100;
    REP (j, n) {
      minnum = min(minnum, c[i][j]);
    }
    REP (j, minnum) {
      cout << (char)(i + 'a');
    }
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int a[maxn];
int main() {
	int n, x, k;
	int ans = 0;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> x;
		if (x >= k) ans++; 
	}
	cout << ans << endl;
	return 0;
}

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

int main() {
    string S;
    cin >> S;
    rep(i, S.length()) {
    	if (i%2 == 0 && S[i] != 'L') continue;
    	else if (i%2 == 1 && S[i] != 'R') continue;
    	else {
    		cout << "No" << endl;
    		return 0;
    	}
    }
    cout << "Yes" << endl;
    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define REP(i, k, n) for(int i = (int)k; i < (int)n; i++)
#define rrep(i, n) RREP(i, 0, n)
#define RREP(i, k, n) for(int i = (int)n-1; i > (int)k-1; i--)
#define mmax(start, end) *max_element(start, end)
#define mmin(start, end) *min_element(start, end)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
int dx8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

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

    int R;
    cin >> R;

    string ans;
    if(R < 1200) ans = "ABC";
    else if(R < 2800) ans = "ARC";
    else ans = "AGC";

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int a,b,min=2020;
	cin>>a>>b;
	if(b-a>=2019) {
		cout<<0<<endl;
		return 0;
	}
	for(int i=a;i<=b-1;i++) {
		for(int j=i+1;j<=b;j++) {
			int x,y;
			x=i%2019;
			y=j%2019;
			x=(x*y)%2019;
			if(x<min)
				min=x;
		}
	}
	cout<<min<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  for(int i=0;i<1e9+1;i++){
    if(abs(a-i)==abs(b-i)){
      cout<<i<<endl;
      return 0;
    }
  }
  cout<<"IMPOSSIBLE"<<endl;
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;
typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<(x)<<endl
#define p2(x,y)                 out<<(x)<<' '<<(y)<<endl
#define p3(x,y,z)               out<<(x)<<' '<<(y)<<' '<<(z)<<endl
#define p4(x,y,z,w)             out<<(x)<<' '<<(y)<<' '<<(z)<<' '<<(w)<<endl
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<(ix == n-1? '':' '); out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define pl(x)                   out<<(x)
#define pll(x)                  out<<(x)<<' '
#define range(v)                v.begin(),v.end()
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

#define EACH(x, a) for (auto& x: a)
template<class T> void read_v(T& x, std::istream& in) {
    in >> (x);
}
template<class A> void read_vec(vector<A>& x, std::istream& in) {
    EACH(a, x)
        read_v(a, in);
}

bool sortpairbysec(const pair<int,int> &a,const pair<int,int> &b){return (a.second < b.second);}
template <typename T>
T factmod(T a, T modulus){ int res = 1, i; for (i = 2; i <= a; i++){ res *= i; res%=modulus;} return res; }
template <typename T>
int powmod(T a,T b,int m){ int ans=1; while(b>0){if(b&1){ans*=a;ans%=m;}a*=a;a%=m;b>>=1;} return ans; }
template <typename T>
int power(T a, T b){ int ans=1; while(b>0){if(b&1){ans*=a;}a*=a;b>>=1;}return ans;}


void ssolve(std::istream& in, std::ostream& out){
    int a, b, c, d; s4(a, b, c, d);
    int ans = max({a*c, a*d, b*c, b*d});
    p(ans);
    return;
}

class BProductMax {
public:
void solve(std::istream& in, std::ostream& out) {
    ios_base::sync_with_stdio(false);
    in.tie(nullptr);out.tie(nullptr);
    int t;
    int READ = 0;
    if(READ) s(t);
    else t = 1;
    while(t--){
        ssolve(in, out);
    }
}
};

integer main() {
    BProductMax solver;
    std::istream& in(std::cin);
     std::ostream& out(std::cout);
     solver.solve(in, out);
}

Measured memory_bytes: 3652
//region Template
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "../debug_prettyprint.hpp"
#else
#define debug(...) 42
#pragma GCC optimize("Ofast")
#pragma GCC target("avx")
#endif
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout<<fixed<<setprecision(12);
#define FOR(i, n) for(int i=0; i<int(n); i++)
#define RNG(i, f, t) for(int i=int(f); i<=int(t); i++)
#define REV(i, f, t) for(int i=int(f); i>=int(t); --i)
#define ALL(v) (v).begin(), (v).end()
#define EXIT(answer) { cerr<<"EXIT #"<<__LINE__<<endl; cout<<answer<<endl; exit(0); }
#define sz(v) int(v.size())
bool RELAXED = false;
template<int,typename T> struct MINMAX{ T val; MINMAX(T val) : val(val) {} };
template<typename T> MINMAX<1,T> MAX(T val) { return MINMAX<1,T>(val); };
template<typename T> MINMAX<2,T> MIN(T val) { return MINMAX<2,T>(val); };
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<1,U> rhs) { return lhs = (rhs.val > lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> inline T& operator|=(T &lhs, MINMAX<2,U> rhs) { return lhs = (rhs.val < lhs ? (RELAXED=true,rhs.val) : (RELAXED=false,lhs)); }
template<typename T, typename U> istream& operator>>(istream& in, pair<T,U> &p) { in>>p.first>>p.second; return in; }
template<typename T> inline vector<T> READ(int n) { vector<T> vec(n); FOR(i,n) cin>>vec[i]; return vec; }
template<typename T> using min_heap = priority_queue<T, vector<T>, greater<T> >;
typedef signed long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
//endregion


int main() {
    FASTIO

    ll n,m,k; cin>>n>>m>>k;
    vi a = READ<int>(n);
    vi b = READ<int>(m);

    vl ma;
    ma.push_back(0);
    FOR(i,n) {
        ma.push_back(ma.back() + a[i]);
    }

    int ans=0;
    int t=0;
    b.push_back(k);
    m++;
    FOR(i,m) {
        if(t>k) break;
        int lb = upper_bound(ALL(ma), k-t) - ma.begin() - 1;
        ans |= MAX(i+lb);
        t += b[i];
    }

    cout<<ans<<endl;



}

Measured memory_bytes: 7408
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    N = int(input())
    S = input().rstrip()
    h = N // 2
    a = S[:h]
    b = S[h:]

    if a == b:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
# -*- coding: utf-8 -*-
from string import ascii_lowercase


def list_n():
    return [int(e) for e in input().split()]


def list_s():
    return [s for e in input().split()]


def main(n, ss):
    answer = ''
    for c in ascii_lowercase:
        answer += c * min([s.count(c) for s in ss])
    return answer


if __name__ == '__main__':
    n = int(input())
    ss = [input() for _ in range(n)]
    print(main(n, ss))


Measured memory_bytes: 4088
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
#define all(v) v.begin(), v.end()
#define bigger (char)toupper
#define smaller (char)tolower
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
typedef unsigned long long ull;

int main() {
    int N;
    string s;
    cin>>N>>s;
    int counter=0;
    rep(i,N-2) {
        if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C') {
            counter++;
        }
    }
    cout<<counter<<endl;
}

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

//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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; }
#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define RES(a,i,j) a.resize(i);rep(ii,i)a[ii].resize(j); 
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 
#define gre(n) greater<n>()

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
const int INF = 1000000000;
const ll INF64 = 922337203685477580ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//メモ
//二次元配列のresizeのしかた
//vv.resize(n);
//for(size_t i=0; i<n; i++){
// vv[i].resize(n);
//}

//メモ
//負の辺を持つ最短経路問題では到達不可経路でも初期化値より小さくなりうるので注意しよう！
int h,w;
bool hani(int i,int j){//grid上探索において範囲内かどうかをreturn
    if(i>=0&&i<h&&j>=0&&j<w)return true;
    else return false;
}


int main(){
    std::cin >> h>>w;
    vvector(a,char,h,w,0);
    reprep(i,j,h,w)std::cin >> a[i][j];
    bool b=1;
    int dx[]={-1,0,1,0,-1};
    reprep(i,j,h,w){
        if(a[i][j]=='#'){
       //   ppri(i,j);
            bool d=0;
            rep(ii,4){
                if(hani(i+dx[ii],j+dx[ii+1])){
                    if(a[i+dx[ii]][j+dx[ii+1]]=='#'){
                      
                        d=1;
                    }
                }
            }
            if(!d)b=0;
        }
    }
    if(b)std::cout << Yes << std::endl;
    else std::cout << No << std::endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<int, int> pi;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second
vector<int> dists;
set<pi> vis;
vector<vector<char>> arr;

void bfs(int first,int second)
{
    queue<pair<pi,int>> q;
    q.push({{first,second},0});
    int dist=0;
    int temp;
    pi curr;
    while(!q.empty())
    {
        curr=q.front().first; temp=q.front().second; q.pop();
        dists.pb(temp);
        dist=temp+1;
        vis.insert(curr);
        if(curr.first!=0 && arr[curr.first-1][curr.second]!='#' && vis.find({curr.first-1,curr.second})==vis.end())
        {
            vis.insert({curr.first-1,curr.second});
            q.push({{curr.first-1,curr.second},dist});
        }
        if(curr.second!=0 && arr[curr.first][curr.second-1]!='#' && vis.find({curr.first,curr.second-1})==vis.end())
        {
            vis.insert({curr.first,curr.second-1});
            q.push({{curr.first,curr.second-1},dist});
        }
        if(curr.first!=sz(arr)-1 && arr[curr.first+1][curr.second]!='#' && vis.find({curr.first+1,curr.second})==vis.end())
        {
            vis.insert({curr.first+1,curr.second});
            q.push({{curr.first+1,curr.second},dist});
        }
        if(curr.second!=sz(arr[0])-1 && arr[curr.first][curr.second+1]!='#' && vis.find({curr.first,curr.second+1})==vis.end())
        {
            vis.insert({curr.first,curr.second+1});
            q.push({{curr.first,curr.second+1},dist});
        }
    }
}

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int h,w;
    cin >> h >> w;
    arr.assign(h,vector<char>(w,0));
    F0R(i,h)
    {
        F0R(j,w)
            cin >> arr[i][j];
    }
    F0R(i,sz(arr))
    {
        F0R(j,sz(arr[i]))
        {
            if(arr[i][j]!='#')
                bfs(i,j);
            vis.clear();
        }
    }
    int best=-1;
    for(auto elem : dists)
        best=max(best,elem);
    cout << best;

    return 0;
}


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

using namespace std;

int main()
{
    char s[3];
    int base = 700;

    scanf("%s", &s);
    for (int i = 0; i < 3; i++)
    {
        base += s[i] == 'o' ? 100 : 0;
    }

    printf("%d", base);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll mc[100001]; //minimum cost
    rep(i, 100001) mc[i] = 1e14;
    int n; cin >> n;
    vector<pii> tv[n + 1]; //tree vector?
    rep(i, n - 1) {
        int a, b ,c; cin >> a >> b >> c;
        tv[a].push_back({b, c});
        tv[b].push_back({a, c});
    }
    int qq, k; cin >> qq >> k;
    mc[k] = 0;
    queue<int> q;
    q.push(k);
    while (!q.empty()) {
        int now = q.front();
        q.pop();
        rep(i, tv[now].size()) {
            int next = tv[now][i].first;
            if (mc[next] > mc[now] + tv[now][i].second) {
                mc[next] = mc[now] + tv[now][i].second;
                q.push(next);
            }
        }
    }
    //rrep(i, 1, n + 1) cout << mc[i] << " "; cout << endl;
    rep(i, qq) {
        int x, y; cin >> x >> y;
        cout << mc[x] + mc[y] << endl;
    }
}


Measured memory_bytes: 8820
/*
      author : Nishikawa
      created: 05.08.2020 21:05:57
*/

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


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

Measured memory_bytes: 3900
//##MohK
//13/2/2020.... 10,00
#include <bits/stdc++.h>
using namespace std ;
using ll = long long ;
using ld = long double;
int main(){
    ll n,b;
    cin>>n;
    set<int>a;
    for(ll i=0;i<n;i++){
        cin>>b;
        a.insert(b);
    }
    cout<<a.size();


 return 0 ;
}




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

int main()
{
  float a;
  float b;
  float c;
  float z;
	cin >> a >> b >> c;
  z = a + b + c;
  if(z>=22)
  {
     cout << "bust" << endl;
  }
  else
  {
    cout << "win" << endl;
  }

	return 0;
}


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

using namespace std;
#define sd(x) scanf("%d",&x);
#define sdl(x) scanf("%lld",&x);
#define pr(x) printf("%d\n",x);
#define prl(x) printf("%lld\n",x);


   long long int gcd(long long int a,long long int b)
{
    if (b<a)return gcd(b,a);
    else if (b%a==0)return a;
    else return gcd(b%a,a);
 
}

long long fast_exp(long long a,long long n,long long mod1)
    {

    if (n==0)return 1;
    else if (n==1)return a;
    if (n%2==0)return fast_exp((a*a)%mod1,n/2,mod1);
    else return (a*fast_exp((a*a)%mod1,n/2,mod1))%mod1;
    }
bool is_square(long long  a)
{
    long long int b=sqrt(a);
    if (b*b==a)return true;
    else return false;
}


void solve()
{
   int n;
   cin >> n;
   vector<int>arr(n);
   unordered_map<int,int>maps;
   for (int c=0;c<n;c++)
    cin >> arr[c],maps[c+1-arr[c]]++;

    long long total=0;
    for (int c=0;c<n;c++)
        total+=maps[arr[c]+c+1]-((c+1-arr[c])==(arr[c]+c+1)?1:0);
    cout << total << endl;
    
}



int main ()
{
      
     int t;
     //cin >> t;
     t=1;
     for (int tt=1;tt<=t;tt++)
     {
         solve();

     }

    return 0;
     
     
     
     
 }


Measured memory_bytes: 19268
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <vector>
using namespace std;

void print(int A[], int N) {
  for (int i = 0; i < N; i++) {
    if (i != N - 1)
      printf("%d ", A[i]);
    else
      printf("%d\n", A[i]);
  }
}

void insertionSort(int A[], int N) {
  int i, j;
  for (i = 1; i < N; i++) {
    int v = A[i];
    j = i - 1;
    while (j >= 0 && A[j] > v) {
      A[j + 1] = A[j];
      j--;
    }
    A[j + 1] = v;
    print(A, N);
  }
}

int main() {
  int N;
  scanf("%d", &N);
  int A[N];
  for (int i = 0; i < N; i++) scanf("%d", &A[i]);
  print(A, N);

  insertionSort(A, N);

  return 0;
}



Measured memory_bytes: 3216
#include<iostream>
#include<vector>
using namespace std;
typedef long long li;
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << "\n";
    cout << *(itr++);
  }
  return os;
}

int main(){
  int n; cin >>n;
  vector<int> ans(n,0);
  li s=0;
  rep(_x,n){
    int x=_x+1;
    s=x*x;
    if(s>n) break;
    rep(_y,n){
      int y=_y+1;
      s=x*x+y*y+x*y;
      if(s>n) break;
      rep(_z,n){
        int z=_z+1;
        s=x*x+y*y+z*z+x*y+y*z+z*x;
        if(s>n)break;
        ans[s-1]++;
      }
    }
  }
  print(ans);
}


Measured memory_bytes: 3588
#include <stdio.h>

int main(void) {

        int a, b, c;

        

        scanf("%d%d%d", &a, &b, &c);

        

        if(a < b && b < c) {

            printf("Yes\n");

        }

        else {

            printf("No\n");

        }

        return 0;

}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)

typedef long long Int;

int main() {
  int A, B, T;
  cin >> A >> B >> T;
  
  cout << (T / A) * B << endl;
  
}

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

int num(int n)
{
    int a[1000000] = {1, 1};
    for (int i = 2; i <= n; ++i)
        for (int j = 2; i * j <= n; ++j)
            a[i * j] = 1;
    int cnt = 0;
    for (int i = 0; i <= n; ++i)
        if (a[i] == 0)
            ++cnt;
    return cnt;
}

int main(void)
{
    int n;
    while (cin >> n)
        cout << num(n) << endl;
    return 0;
}



Measured memory_bytes: 6984