akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <cmath>
#include <limits>
#include <bitset> 
#include <iterator> 
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include<deque>
#include <regex>
#include <list>
#include <unordered_set>
#define rep(i,n) for(ll i=0;i<(n); ++i)
#define per(i,n) for(ll i=n-1;i>=0; --i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define _GLIBCXX_DEBUG
using namespace std;
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; }
const long long INF = 1LL << 60;
typedef long long ll;
const ll MOD = 1000000007;
ll getDigit(ll n) {
	ll cnt = 0;
	while (n != 0) {
		n /= 10;
		cnt++;
	}
	return cnt;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
typedef pair<double, long long> pair_t;
bool PSecComp(const pair_t& a, const pair_t& b) {
	if (a.second == b.second)return  a.first > b.first;
	else {
		return a.second > b.second;
	}
}

int main() {
	ll n, m;
	cin >> n >> m;
	vector<ll>a(n),b(m),c(m),goodBc;
	rep(i, n)cin >> a[i];
	rep(i, m)cin >> b[i] >> c[i];
	
	vector<pair<ll, ll>>bc;
	rep(i, m)bc.push_back(make_pair(b[i],c[i]));
	sort(all(bc),PSecComp);
	for (ll i = 0; i < m; i++) {
		if (goodBc.size() == n)break;
		else {
			ll rest = n - goodBc.size();
			rep(p,min(bc[i].first,rest))goodBc.push_back(bc[i].second);
		}
	}
	ll sumA = accumulate(all(a),0LL);
	ll maxSum = accumulate(all(a),0LL);
	sort(all(a));
	for (ll i = 0; i < goodBc.size(); i++) {;
		sumA += (goodBc[i] - a[i]);
		maxSum = max(maxSum, sumA);
	}
	cout << maxSum << endl;
}


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

using namespace std;
using ll=long long;

#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  int n;cin>>n;
  map<string,int> map;
  string s;
  rep(i,n){
    cin>>s;
    map[s]=0;
  }
  int cnt=0;
  for(auto itr = map.begin(); itr != map.end(); ++itr)cnt++;
  cout<<cnt<<endl;
}


Measured memory_bytes: 19284
#include"bits/stdc++.h"

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
	double n, k;
	cin >> n >> k;
	cout << ceil((n - k) / (k - 1.0)) + 1 << endl;
	return 0;
}


Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
using namespace std;

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

int main() {
	int n;
	ll m;
	while(cin >> n >> m, n||m) {
		ll dist[11] = {};
		rep(i, n) {
			int d, p;
			cin >> d >> p;
			dist[p] += d;
		}
		for(int i=10; i>0 && m>0; i--) {
			ll l = min( dist[i], m );
			dist[i] -= l;
			m -= l;
		}
		ll res = 0;
		for(int i=1; i<=10; i++) {
			res += i * dist[i];
		}
		cout << res << endl;
	}
	return 0;
}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int a , b;
string s , t , u;

int main()
{
    _FastIO;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(u == s){
        a--;
    }
    else
        b--;
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
A, B, C, K = [int(x) for x in stdin.readline().rstrip().split()]
if K-A <= 0:
    print(K)
elif K-A > 0:
    if K-A-B <= 0:
        print(A)
    else:
        print(int(A+(K-A-B)*-1))


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

using namespace std;

//#define _FILES
#define PB push_back
#define MP make_pair
#define X first
#define Y second

int main()
{
    ios_base::sync_with_stdio(false);

    #ifdef _FILES
        freopen("","r",stdin);
        freopen("","w",stdout);
    #endif // _FILES

    long long n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;

    if (a > b) swap(a, b);
    for (int i=0; i < n;i++)
    {
        if ((b - a >= c *(n - 1 - i) - i * d) && (b - a <= -c * i + (n - 1 - i) * d))
        {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << 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;

int main() {
  string S,T;
  int sum = 0;
  cin >> S >> T;
  rep(i, S.size()) {
    if(S[i] != T[i]) sum++;
  }
  cout << sum << endl;
  return 0;
}




Measured memory_bytes: 3776
#include <iostream>
#include <cmath>
#include <bitset>
using namespace std;
const int N = 100;
const int M = 6401;
const int Y = 6400;
int H, W, A[N][N], B[N][N];
bitset<M*2> dp[N][N];

int main(){
    cin >> H >> W;
    for (int i = 1; i <= H; i++)
        for (int j = 1; j <= W; j++)
            cin >> A[i][j];
    for (int i = 1; i <= H; i++)
        for (int j = 1; j <= W; j++)
            cin >> B[i][j];
    dp[0][1][Y] = dp[1][0][Y] = 1;
    for (int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j++){
            int d = abs(A[i][j] - B[i][j]);
            dp[i][j] |= ((dp[i-1][j] << d)|(dp[i-1][j] >> d));
            dp[i][j] |= ((dp[i][j-1] << d)|(dp[i][j-1] >> d));
        }
    }
    int ans = INT32_MAX;
    for (int i = 0; i < 2*M; i++)
        if (dp[H][W][i]) ans = min(ans, abs(i - Y));
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 14208
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	//文字列から10進数に変換するときはparseIntを使います
	var a = parseInt(input[0], 10);
	var b = parseInt(input[1], 10);
	var h = parseInt(input[2], 10);
	//出力
	console.log((a+b)*h/2);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <iostream>
//#include <numeric>
//#include <vector>
#include<math.h>
#include<cmath>
#include <stdio.h> 
//#include <cstdint>
//#include <string>
//#include <cstdlib>
//#define pi 3.14159265359
using namespace std;

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


	if (n%2==0) {
		cout << n / 2 - 1;
	}
	else {
		cout << n / 2;
	}

	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
string S,T;
int occ[26];
vector<int> s1,s2;
int main(){
    cin>>S>>T;

    for(int i=0;i<S.size();i++)occ[S[i] - 'a']++;
    for(int i=0;i<26;i++)s1.push_back(occ[i]);
    sort(s1.begin(),s1.end());

    memset(occ,0,sizeof occ);
    for(int i=0;i<T.size();i++)occ[T[i] - 'a']++;
    for(int i=0;i<26;i++)s2.push_back(occ[i]);
    sort(s2.begin(),s2.end());

    for(int i=0;i<26;i++)
        if(s1[i] != s2[i])return cout<<"No"<<endl, 0;
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 776
#include <bits/stdc++.h>
#define MAXN 3007
#define MOD 998244353
using namespace std;
long long dp[MAXN][MAXN];
int main()
{
	int a,b,c,d; cin>>a>>b>>c>>d;
	dp[a][b]=1;
	for(int i=a;i<=c;i++) for(int j=b;j<=d;j++) if(a!=i || b!=j) dp[i][j]=(i*dp[i][j-1]+j*dp[i-1][j]-((i-1LL)*(j-1LL)*dp[i-1][j-1])%MOD+MOD)%MOD;
	cout<<dp[c][d];
}


Measured memory_bytes: 74044
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int dp[1<<13][13][13];
int dfs(int m, int l, int r)
{
    if(dp[m][l][r]>=0) return dp[m][l][r];
    if(m==0) return 1;

    int enemy = 0;
    rep(i,13)if(!(l<=i && i<=r) && !(m>>i&1)) enemy |= 1<<i;

    int ret = 0;
    bool pass = true;
    if(l-1>=0 && (m>>(l-1))&1)
    {
        pass = false;
        ret |= !dfs(enemy, l-1, r);
    }
    if(r+1<=12 && (m>>(r+1))&1)
    {
        pass = false;
        ret |= !dfs(enemy, l, r+1);
    }

    if(pass) ret |= !dfs(enemy,l,r);

    return dp[m][l][r] = ret;
}

int main()
{
    memset(dp,-1,sizeof(dp));

    int n;
    cin >>n;
    while(n--)
    {
        int mask = 0;
        rep(i,6)
        {
            int f;
            cin >>f;
            --f;

            mask |= 1<<f;
        }

        string ans = "no";
        if(dfs(mask,6,6)==1) ans = "yes";
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 8560
//////AGC039-B//////
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll n,ans=0;
void Main(){
    cin>>n;
    vector<ll> l(n);
    For(i,0,n)cin>>l.at(i);
    sort(ALL(l));
    For(i,0,n-2){
        For(j,i+1,n-1){
            For(k,j+1,n){
                if(l.at(i)+l.at(j)>l.at(k)) ans++;
            }
        }
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


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

#define Fast            ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define fWrite          freopen ("out.txt","w",stdout);
#define TC              int t;cin >> t;FOR(tc,1,t)
#define LL              long long
#define ULL             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define all(a)          a.begin(),a.end()
#define MEM(a,x)        memset(a,x,sizeof(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)

#define Make(x,p)       (x  (1<<p))
#define DeMake(x,p)     (x & ~(1<<p))
#define Check(x,p)      (x & (1<<p))
#define popcount(x)     __builtin_popcount(x)

const LL mod=1e9+7;
const int N=50;
void MatMul(LL A[N][N], LL B[N][N])
{
    LL R[N][N];
    MEM(R,0);
    REP(i, N) REP(j, N) REP(k, N) R[i][j] = (R[i][j]%mod + (A[i][k] * B[k][j])%mod)%mod;
    REP(i, N) REP(j, N) B[i][j] = R[i][j];
    return;
}
void MatPow(LL R[N][N],LL M[N][N],LL P)
{
    while(P)
    {
        if(P & 1)
            MatMul(M,R);
        MatMul(M,M);
        P = P >> 1;
    }
}

int main()
{
    LL n,k;
    cin >> n >> k;
    LL R[N][N],M[N][N];
    MEM(R,0);
    MEM(M,0);
    REP(i,n) REP(j,n) cin >> M[i][j];
    REP(i,n) REP(j,n) R[i][j]=M[i][j];
    MatPow(R,M,k-1);
    LL sum=0;
    REP(i,n) REP(j,n) sum=(sum+R[i][j])%mod;
    cout << sum;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void)
{
	double x1, y1, x2, y2, x3, y3, px, py, r;
	int i, n;
	
	scanf("%d", &n);
	
	for (i = 0; i < n; i++){
		scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
	
		px = ((y1 - y3)*(y1*y1 - y2*y2 + x1*x1 - x2*x2) - (y1 - y2)*(y1*y1 - y3*y3 + x1*x1 - x3*x3)) / (2 * (y1 - y3)*(x1 - x2) - 2 * (y1 - y2)*(x1 - x3));
		py = ((x1 - x3)*(x1*x1 - x2*x2 + y1*y1 - y2*y2) - (x1 - x2)*(x1*x1 - x3*x3 + y1*y1 - y3*y3)) / (2 * (x1 - x3)*(y1 - y2) - 2 * (x1 - x2)*(y1 - y3));
	
		r = (x1 - px)*(x1 - px) + (y1 - py)*(y1 - py);
	
		r = sqrt(r);
	
		printf("%.3lf %.3lf %.3lf\n", px, py, r);
	}
	
	return (0);
}

Measured memory_bytes: 664
#include<iostream>
#include<vector>
#include<stack>
using namespace std;
int n,m;
static const int MAX = 100000;
static const int NIL = -1; 
vector<int> graph[MAX];
int color[MAX];
void dfs(int s,int t)
{
	
	stack<int> ss;
	ss.push(s);
	color[s]=t;
	while(!ss.empty())
	{
		int u=ss.top();
		ss.pop();
		for(int i=0;i<graph[u].size();i++)
		{
			int v=graph[u][i];
			if(color[v]==NIL)
			{
				color[v]=t;
				ss.push(v);
			}
		}
	}
}
void assigncolor()
{
	int id=1;
	for(int i=0;i<n;i++)
		color[i]=NIL;
	for(int u=0;u<n;u++)
	{
		if(color[u]==NIL)
			dfs(u,id++);
	}
}
int main()
{
	cin>>n>>m;
	
	for(int i=0;i<m;i++)
	{
		int s,t;
		cin>>s>>t;
		graph[s].push_back(t);
		graph[t].push_back(s);
	}
	assigncolor();
	int q;
	cin>>q;
	while(q--)
	{
		int s,t;
		cin>>s>>t;
		if(color[s]==color[t])
			cout<<"yes"<<endl;
		else cout<<"no"<<endl;
	}
	return 0;
 } 


Measured memory_bytes: 9040
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int h, w;
    cin >> h >> w;
    rep(i, 0, h)
    {
        string s;
        cin >> s;
        cout << s << "\n" << s << "\n";
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#define INT long long int
using namespace std;
int main(){
	INT a,b,c,d,i;
	cin>>a>>b;
	INT p[100000],q[100000];
	p[0]=1;
	q[0]=0;
	for(i=1;i<a;i++){
		p[i]=0;
		q[i]=1;
	}
	for(i=0;i<b;i++){
		cin>>c>>d;
		c--;
		d--;
		if(p[c]){
			if(!q[c])
				p[c]=0;
			else
				q[c]--;
			if(p[d])
				q[d]++;
			p[d]=1;
		}else{
			q[c]--;
			q[d]++;
		}
	}
	INT n=0;
	for(i=0;i<a;i++)
		n+=p[i];
	cout<<n<<endl;
}

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll r;
    cin>>r;
    cout<<power(r,2);
    


}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    vector<int> x(3);
    rep(i,0,3) cin>>x[i];
    sort(all(x));
    int cnt=0;
    while(x[1]<x[2]){
        x[0]++;
        x[1]++;
        cnt++;
    }
    while(x[0]<x[1]){
        x[0]+=2;
        cnt++;
    }
    if(x[0]>x[1]) cnt++;
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		try(Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int[] a = new int[n];
			for(int i = 0 ; i < n ; i++) {
				a[i] = sc.nextInt();
			}
			long total = Arrays.stream(a).sum();
			double border = total / 4d / m;
			long enable = Arrays.stream(a).filter(i -> i >= border).count();
			System.out.println(enable >= m ? "Yes" : "No");
		}

	}

}


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

struct UnionFind {
  //親を管理するvector
  //自身が親ならその集合に属する頂点数に-1をかける
  //そうでなければ親のid
  vector<int> r;
  
  UnionFind(int N) {
    r = vector<int>(N, -1);
  }
  
  int root(int x) {
    if (r[x] < 0) return x;
    return r[x] = root(r[x]);
  }
  
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (r[x] > r[y]) swap(x, y);
    r[x] += r[y];
    r[y] = x;
    return true;
  }
  
  int size(int x) {
    return -r[root(x)];
  }
  
};


int main() {
  int N, M;
  cin >> N >> M;
  
  UnionFind UF(N);
  
  for (int i = 0; i < M; i++) {
    int A, B;
    cin >> A >> B;
    A -= 1, B -= 1;
    UF.unite(A, B);
  }
  
  int ans = 0;
  for (int i = 0; i < N; i++) {
    ans = max(ans, UF.size(i));
  }
  
  cout << ans << endl;

}

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

using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<long long, long long> pl;

const int MOD = 1e9 + 7;
const ll INF = 1e18;
const double EPS = 1e-6;
const int MAX_N = 1e5 + 5;

int N, K, Q;
int players[MAX_N];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> N >> K >> Q;
	for (int i = 0; i < Q; ++i) {
		int a; cin >> a;
		++players[--a]; 
	}

	for (int i = 0; i < N; ++i) {
		if (players[i] + K - Q > 0) {
			cout << "Yes\n";
		}
		else {
			cout << "No\n";
		}
	}

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>

using namespace std;

typedef long long ll;

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

    int s = 0; //各桁の和
    int n_ = n;
    while (n_ > 0)
    {
        s += n_ % 10;
        n_ /= 10;
    }

    if (n % s == 0)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int f(int n){
  if(n==0||n==1){
    return 1;
  }else return n*f(n-1);
}



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

Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
#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, n, m) for (int i = m; i < n; i++)
#define MM(i, n, m) for (int i = m; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
 * pair<型, 型> 変数名
 * map<型, 型> 変数名  // 連想配列
 * priority_queue<型> 変数名  // 最大値から出てくるヒープ
*/
int main()
{
    int N, R;
    cin >> N >> R;
    if (N >= 10)
    {
        cout << R << endl;
    }
    else
    {
        cout << R + 100 * (10 - N) << 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;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<vector<int> > Graph;

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

Measured memory_bytes: 256
// SeeAlso: https://atcoder.jp/contests/dp/tasks/dp_b

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define MAX 100000
#define NIL -1
#define MOD 1000000007

typedef int _loop_int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define debug(x) cout<<#x<<": "<<x<<endl
#define debig_vec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

// 最大公約数
inline constexpr ll gcd(ll a,ll b){if(!a||!b)return 0;while(b){ll c=b;b=a%b;a=c;}return a;}
// 最小公倍数
inline constexpr ll lcm(ll a,ll b){if(!a||!b)return 0;return a*b/gcd(a,b);}

#define print2D(h, w, arr) rep(i, h) { rep(j, w) cout << arr[i][j] << " "; cout << endl; }
template<class T> void print(const T& x){cout << setprecision(12) << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }

int n, k;
int h[MAX];


int main (){ 

    cin >> n >> k;
    memset(h, 0, sizeof(h));
    rep(i, n) {
        cin >> h[i];
    }
    
    ll dp[n+5];
    memset(dp, -1, sizeof(dp));
    dp[0] = 0;
    rep(i, n) {
        FOR(j,i+1,min(i+k+1, n)) {
            if(dp[j] >= 0) {
                dp[j] = min(dp[j], dp[i]+abs(h[j]-h[i]));
            } else {
                dp[j] = dp[i]+abs(h[j]-h[i]);
            }
        }
    }

    print(dp[n-1]);
    return 0;
}   

Measured memory_bytes: 1408
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
		// スペース区切りの整数の入力
		int D = sc.nextInt();
        int A[];
		A = new int[N];
        int B[];
		B = new int[N];
        for (int i = 0; i < N; i++){
			 A[i] = sc.nextInt();
			 B[i] = sc.nextInt();
        }
        double X[];
		X = new double[N];
        double Y[];
		Y = new double[N];
        for (int i = 0; i < N; i++){
			 X[i] = A[i];
			 Y[i] = B[i];
        }
        double L;
        int Nstep ;
        Nstep=0;
        for (int j = 0; j < N; j++){
        	L=Math.sqrt((X[j]*X[j])+(Y[j]*Y[j]));
      	    if (L<=D){
        		Nstep=Nstep+1;
        	}
        }
		// 出力
		System.out.println(Nstep);
	}
}


Measured memory_bytes: 61164
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
3 4 6
0 0
0 2
0 3
1 1
2 1
2 3

output:
3
"""

import sys


def generate_adj_table(_edges):
    for edge in _edges:
        vx, vy = map(int, edge)
        init_adj_table[vx].append(vy)

    return init_adj_table


def graph_dfs(current, matching, visited):
    for adj in range(y_num):
        if adj in adj_table[current] and not visited[adj]:
            visited[adj] = True
            if matching[adj] == -1 or graph_dfs(matching[adj], matching, visited):
                matching[adj] = current
                return True
    return False


def mbm():
    matching = [-1] * y_num
    res = 0
    for v in range(x_num):
        visited = [False] * y_num
        if graph_dfs(v, matching, visited):
            res += 1
    # print(matching)
    return res


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    x_num, y_num, e_num = map(int, _input[0].split())
    edges = map(lambda x: x.split(), _input[1:])

    v_num = x_num + y_num
    init_adj_table = [[] for _ in range(x_num)]
    adj_table = generate_adj_table(edges)
    print(mbm())

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

int main(){
    int x;
    cin>>x;
    int a,b;
    int tmp,tmp2;
    bool flg=false;
    for(a=-118;a<=119;a++){
        for(b=-119;b<a;b++){
            tmp=pow(a,5)-pow(b,5);
            tmp2=pow(a,5)+pow(b,5);
            if(tmp==x){
                flg=true;
                break;
            }
            if(tmp2==x){
                flg=true;
                break;
            }
        }
        if(flg) break;
    }
    cout<<a<<" "<<b<<endl;
}

Measured memory_bytes: 3988
//前置き
#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<set>
#include<map>
#include<stack>
#include<queue>

using namespace std;

typedef  long long ll;

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))

#define PRINT(str) printf(#str "\n")
#define yOUT PRINT(Yes)
#define nOUT PRINT(No)
#define YOUT PRINT(YES)
#define NOUT PRINT(NO)

//関数定義
//偶数 ->　true :: 奇数　-> false
bool EVEN(ll a);

//最大公約数
ll gcd(ll a, ll b);

//最小公倍数
ll lcm(ll a, ll b);

int main(){
    // ========================================================
    int n;
    cin >> n;
    cout << pow(n,3) << endl;
}

//偶数 ->　true :: 奇数　-> false
bool EVEN(ll a){
    return a%2;
}

//最大公約数
ll gcd(ll a, ll b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}

//最小公倍数
ll lcm(ll a, ll b) {  
    return a*b/gcd(a,b);  
} 

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <functional>
#include <cmath>
#include <array>

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI;
typedef pair<int,int> pii;
const int mod = (int)1e9+7;

int n, k;
vector<VI> r;

const int inf=1<<28;


VI bfs(int s) {
	VI dd(n,inf);
	queue< int > que;
	que.push(s); dd[s]=0;
	while(!que.empty()){
		int cx = que.front();
		que.pop();
		for(auto xr : r[cx]){
			if(dd[xr]==inf){
				dd[xr] = dd[cx] + 1;
				que.push(xr);
			}
		}
	}
	return dd;
}


int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	cin >>n >> k;
	r.resize(n);
	vector<VI> vbs(n, VI(n,0));
	rep(i,n-1){
		int a,b; cin >>a >>b;
		r[a-1].push_back(b-1);
		r[b-1].push_back(a-1);
	}
	rep(i,n) vbs[i] = bfs(i);

	int ans = inf;
	vector<VI> pv;
	
	if(k%2==0){
		rep(i,n){
			int sm=0;
			rep(j,n) if(vbs[i][j] > k/2) sm++;
			ans = min(ans, sm);
		}
	}else{
		rep(i,n) rep(j,sz(r[i])) if(i<r[i][j]) pv.push_back(VI{i,r[i][j]});
		rep(i, sz(pv)){
			auto cv = vbs[pv[i][0]];
			int sm=0;
			rep(j,n) cv[j] = min(cv[j], vbs[pv[i][1]][j]);
			rep(j,n) if(cv[j] > k/2) sm++;
			ans = min(ans, sm);
		}
	}
	
	cout << ans <<endl;
	return 0;
}


Measured memory_bytes: 16256
#include <stdio.h>
#include <string.h>
 
int main(void){
  int a,b,t;
  int da = 0;
  
  scanf("%d %d %d",&a,&b,&t);
  da=t/a;
  da=da*b;

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


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

using namespace std;

#define mP make_pair
#define pB push_back
#define ll long long

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

	for(int i = 0 ; i <= n ; ++i){
		for(int j = 0 ; j <= n ; ++j){
			int k = n - i - j;
			if(k >= 0 && i * 10000 + j * 5000 + k * 1000 == y){
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}

	cout << -1 << " " << -1 << " " << -1 << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  
  cin >> N;
  
  int dig1000 = N / 1000;
  int dig100 = (N - dig1000 * 1000) / 100;
  int dig10 = (N - dig1000 * 1000 - dig100 * 100) / 10;
  int dig1 = N - dig1000 * 1000 - dig100 * 100 - dig10 * 10;
  
  if (((dig1000 == dig100) && (dig100 == dig10)) || ((dig100 == dig10) && (dig10 == dig1))) cout << "Yes" << endl;    
  else cout << "No" << endl;

}

Measured memory_bytes: 256
while 1:
    w, h = map(int, raw_input().split())
    if w == 0: break
    dp = [[[0]*4 for i in range(w + 1)] for j in range(h + 1)]
    dp[1][0][0] = dp[0][1][3] = 1
    for i in range(h):
        for j in range(w):
            dp[i + 1][j][0] += dp[i][j][0] + dp[i][j][2]
            dp[i][j + 1][1] += dp[i][j][0]
            dp[i + 1][j][2] += dp[i][j][3]
            dp[i][j + 1][3] += dp[i][j][1] + dp[i][j][3]
    print reduce(lambda a, x: (a + x) % 100000, dp[h - 1][w - 1])

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

int main(){
	double xa1, ya1, xa2, ya2, xb1, yb1, xb2, yb2;
	while(scanf("%lf%lf%lf%lf%lf%lf%lf%lf",
		&xa1, &ya1, &xa2, &ya2, &xb1, &yb1, &xb2, &yb2) != EOF){

		if(xa1 > xb2 || xb1 > xa2 || ya1 > yb2 || yb1 > ya2){
			puts("NO");
		}
		else{
			puts("YES");
		}
	}
}

Measured memory_bytes: 1040
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)

int main(){
  int N;
  cin >> N;
  vector<double> x(N);
  vector<double> y(N);
  rep(i, N){
    cin >> x.at(i) >> y.at(i);
  }
  vector<vector<double>> dist(N, vector<double>(N));
  rep(i, N){
    rep(j, N){
      dist.at(i).at(j) = pow(pow((x.at(i)-x.at(j)), 2)+pow((y.at(i)-y.at(j)), 2), 0.5);
    }
  }
  vector<int> a(N);
  rep(i, N){
    a.at(i) = i;
  }
  int fac = 1;
  rep(i, N){
    fac *= (i+1);
  }
  vector<double> route(fac, 0);
  int c = 0;
  do {
    rep(i, N-1){
      route.at(c) += dist.at(a.at(i)).at(a.at(i+1));
    }
    c++;
  } while (next_permutation(all(a)));
  double sum = 0;
  rep(i, fac){
    sum += route.at(i);
  }
  cout << fixed << setprecision(10);
  cout << sum / (double)fac << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdlib>
#include<ctime>
#include<cstdio>
#include<string>
//#include<string>
//#include<sstream>
#include<iomanip>
using namespace std;
int main() {
	long long  n,a,b;
	long long x[100000],i;
	scanf("%lld%lld%lld",&n,&a,&b);
	for(i=0;i<n;i++){
		scanf("%lld",&x[i]);
	}
	long long sum=0;
	for(i=1;i<n;i++){
		sum+=min((x[i]-x[i-1])*a,b);
	}
	printf("%lld\n",sum);
}

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

int main()
{
    ll x, y;
    cin >> x >> y;

    ll c = 4 * x - y;
    ll t = y - 2 * x;

    if (c % 2 == 0 && c >= 0 && t % 2 == 0 && t >= 0 && !(c == 0 && t == 0))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define rep(i,n); for(int i = 0;i < (n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
long double pi = acos(-1);
const int INF = 1001001001;


// 最小公倍数を求める
int euqlid (int a, int b){
  int temp;
  temp = a % b;
  if(temp == 0)return b;
  return euqlid(b,temp);
}
ll conbination(ll a,ll b){
  ll u = 1;
  ll d = 1;
  while(b != 0){
    u *= a;
    d *= b;
    a--;
    b--;
  }
  return u / d;
}
int strtoint(char s){
  return (int(s-'0'));
}
int fact(int n){
  if(n == 1)return 1;
  return n * fact(n-1);
  }


int main(){
  int n, a;
  cin >> n >> a;
  cout << ((n%500 <= a)?"Yes":"No") << endl;
}


Measured memory_bytes: 256
import sys
from math import factorial, ceil, floor
from bisect import bisect_right as bsr
from operator import itemgetter as ig
from collections import defaultdict as dd
from collections import deque

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)
def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][0]) for _ in range(ps[0][1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]

# エントリーポイント
def main():
    S, T = input(str, str)
    swap_st, swap_ts = {}, {}
    for s, t in zip(S, T):
        if not s in swap_st:
            swap_st[s] = t
        else:
            if swap_st[s] != t:
                print("No")
                break
        if not t in swap_ts:
            swap_ts[t] = s
        else:
            if swap_ts[t] != s:
                print("No")
                break
    else:
        print("Yes")

if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


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

using namespace std;

int main(){

  int n;

  cin >> n;

  int room;
  int cnt = 0;
  
  for(int i = 0;i < n;++i){
    cin >> room;

    for(int y = 1;y*y <= room;++y){
      if((room - y) % (2 * y + 1) == 0){
	cnt++;
	break;
      }
    }
    
  }

  cout << n - cnt << endl;
  
}



Measured memory_bytes: 3100
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def sieve(n):
    if n == 1:return []
    primes = [1 if i%2 == 1 else 0 for i in range(n + 1)]
    primes[1] = 0
    primes[2] = 1
    for i in range(3,n + 1,2):
        if i * i > n:
            break
        if primes[i]:
            for j in range(i * i,n + 1,i):
                primes[j] = 0
    return [p for p in range(2,n + 1) if primes[p] == 1]

def factorization(n,primes):
    factor = {}
    for p in primes:
        while n%p == 0:
            n //= p
            if p in factor:
                factor[p] += 1
            else:
                factor[p] = 1
    
    if n != 1:
        factor[n] = 1
    
    return factor

def main():
    N = int(input())
    primes = sieve(1000005)
    factor = factorization(N,primes)
    ans = 0
    for k,v in factor.items():
        i = 1
        while v - i >= 0:
            v -= i
            ans += 1
            i += 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 20088
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;   
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ld double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sz(a) (ll)(a.size())
typedef long long ll;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef vector<pll> vplll;
ll mod = 1e9+7;
ll m[100005];
ll cost(ll ans, ll ar[], ll k,ll n)
{
	if(m[k]!=-1)
		return m[k];
	if(k==n-1)
		return 0;
	else if(k==n-2)
		return abs(ar[n-1]-ar[n-2]);
	ans += min(abs(ar[k+1]-ar[k])+cost(ans,ar,k+1,n),abs(ar[k+2]-ar[k])+cost(ans,ar,k+2,n));
	m[k] = ans;
	return ans;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long int a,b,c,x,n,t; 
    for(int i=0;i<100005;i++)
    	m[i]=-1;
    cin>>n;
    ll ar[n+2];
    ar[n]=0;
    ar[n+1]=0;
    for(int i=0;i<n;i++)
    	cin>>ar[i];
    ll ans;
    ans = cost(0, ar,0,n);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

int main()
{int n;
 cin >> n;
 
 int l[n];
 rep(i,n) cin >> l[i];
 
 int sum = 0;
 int m = 0;
 
 rep(i,n){
  sum += l[i];
   m = max (m,l[i]);   
 }
 
 sum -= m;
 
 cout << (sum > m ? "Yes" : "No") << endl;
    
    return 0;
}

Measured memory_bytes: 256
S = input()
if S[0] == S[1] == S[2] == S[3]:
  print('No')
elif (S[0] == S[1] and S[2] == S[3]) or (S[0] == S[2] and S[1] == S[3]) or (S[0] == S[3] and S[1] == S[2]):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <math.h>
#include <stdio.h>

#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string>
#include <vector>

using namespace std;

const long long INF = 1LL << 60;

//各桁の和を出力
long long Sum(long long n) {
  long long m = 0;
  while (n) {
    m += n % 10;
    n /= 10;
  }
  return m;
}

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void Comuse() {
  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;
  }
}

#define comuse Comuse()
// nCk(comuseを使え)
long long combi(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;
}
// pCk(comuseを使え)
long long perm(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] % MOD) % MOD;
}

//最小公倍数(aとbの)
long long lcm(long long a, long long b) {
  long long n;
  n = a / __gcd(a, b) * b;
  return n;
}

// auto A = div(n)
vector<long long> div(long long n) {
  vector<long long> ret;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) {
        ret.push_back(n / i);
      }
    }
  }
  sort(ret.begin(), ret.end());
  return ret;
}

//(aのn乗をmodで割ったあまり)
long long modpow(long long a, long long n, long long mod) {
  long long ans = 1;
  while (n > 0) {
    if (n & 1) {
      ans = ans * a % mod;
    }

    a = a * a % mod;

    n >>= 1;
  }

  return ans;
}

void solve();

const int MAX_N = 131072;
// segment tree
int NN;
int seg[MAX_N * 2 - 1];
void seguse() {
  for (int i = 0; i < 2 * NN - 1; i++) {
    seg[i] = INT_MAX;
  }
}

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

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

int K;
void solve() {
  queue<long long> lunlun;
  cin >> K;
  for(int i = 0; i < 9 ;i++){
    lunlun.push(i+1);
  }
  for(int i = 0; i < K - 1; i++){
    long long X = lunlun.front();
    lunlun.pop();
    if(X % 10 != 0){
      lunlun.push(X * 10 + X % 10 - 1);
    }
    lunlun.push(X * 10 + X % 10);
    if(X % 10 != 9){
      lunlun.push(X * 10 + X % 10 + 1);
    }
  }
  cout << lunlun.front() ;
}

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

typedef struct{
    char pic;
    int num;
} Card;

#define INFTY 1000000001
void mergeSort(int,int);
void merge(int,int,int);
int partition(int,int);
void quickSort(int,int);
int n;
Card Q[N],M[N],L[N/2+2],R[N/2+2];

int main(){
    int i,data,judge = 1;
    char str[2];

    scanf("%d",&n);

    for(i=0;i<n;i++){
        scanf("%s%d",str,&data);
        Q[i].pic = str[0];
        Q[i].num = data;
        M[i].pic = str[0];
        M[i].num = data;
    }

    quickSort(0,n-1);
    mergeSort(0,n);

    for(i=0;i<n;i++){
        if(Q[i].pic != M[i].pic){
            judge = 0;
        }
    }

    if(judge == 1){
        printf("Stable\n");
    }
    else{
        printf("Not stable\n");
    }

    for(i=0;i<n;i++){
        printf("%c %d\n",Q[i].pic,Q[i].num);
    }

    return 0;
}

int partition(int p,int r){
    int i,j;
    Card tmp,x;

    x = Q[r];
    i = p-1;
    for(j=p;j<r;j++){
        if(Q[j].num <= x.num){
            i = i+1;
            tmp = Q[i];
            Q[i] = Q[j];
            Q[j] = tmp;
        }
    }
        tmp = Q[i+1];
        Q[i+1] = Q[r];
        Q[r] = tmp;
    return i+1;
}

void quickSort(int p,int r){
    int q;

    if(p<r){
        q = partition(p,r);
        quickSort(p,q-1);
        quickSort(q+1,r);
    }
}

void merge(int left,int mid,int right){
    int n1,n2,i,j,k;
    n1 = mid - left;
    n2 = right - mid;
    for(i=0;i<n1;i++){
        L[i] = M[left + i];
    }
    for(i=0;i<n2;i++){
        R[i] = M[mid+i];
    }
    L[n1].num = INFTY;
    R[n2].num = INFTY;
    i = 0;
    j = 0;
    for(k = left;k<right;k++){
        if(L[i].num <= R[j].num){
            M[k] = L[i];
            i = i + 1;
        }
        else{
            M[k] = R[j];
            j = j + 1;
        }
    }
}
void mergeSort(int left,int right){
    int mid;
    if(left+1 < right){
        mid = (left + right)/2;
        mergeSort(left,mid);
        mergeSort(mid,right);
        merge(left,mid,right);
    }
}


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

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define repr(i,n) for(int i=(n);i>=0;--i)
#define cinv(n,vec) VL (vec)(n);for(auto&v:vec)cin>>v;
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t make_tuple
#define eb emplace_back
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a),greater<>())
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define debgp(a) cout<<#a<<" "<<a.fi<<" : "<<a.se<<endl
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define out(a) cout<<(a)<<endl
#define cont const auto
#define fi first
#define se second
#define V vector
#define P pair
#define T tuple
#define VV(type,name,y,x,a) vector<vector<type>> name = vector<vector<type>>(y,vector<type>(x,a))
#define PQ priority_queue
typedef long long ll;
typedef double D;
typedef long double LD;
typedef string str;
typedef vector<ll> VL;
typedef pair<ll,ll> PL;
typedef vector<pair<ll,ll>> VP;
typedef tuple<ll,ll,ll> T3;
typedef tuple<ll,ll,ll,ll> T4;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
template<class T>inline bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n,a,b,c,d;
  str s;
  cin>>n>>a>>b>>c>>d>>s;
  a--;b--;c--;d--;
  int e=min(a,b);
  int f=max(c,d);
  for(int i=e;i<f-1;++i){
    if(s[i]=='#'  && s[i+1]=='#'){
      out("No");
      return 0;
    }
  }
  if(c<d){
    Yes();
    return 0;
  }
  for(int i=e;i<f-1;++i){
    if(s[i]=='.' && s[i+1]=='.' && s[i+2]=='.'){
      if(b<i+2&&i<d){
        Yes();
        return 0;
      }
    }
  }
  No();
  
  
  
  return 0;
}



Measured memory_bytes: 592
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 2e5 + 5;
int l, n;
int x[maxn];

bool read() {
  if (scanf("%d%d", &l, &n) < 2) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &x[i]);
  }
  return true;
}

long long pref[maxn], suff[maxn];

void solve() {
  pref[0] = 0;
  for (int i = 0; i < n; i++) {
    pref[i + 1] = pref[i] + x[i];
  }
  suff[n] = 0;
  for (int i = n - 1; i >= 0; i--) {
    suff[i] = suff[i + 1] + (l - x[i]);
  }
  long long res = max(l - x[0], x[n - 1]);
  for (int i = 0; i + 1 < n; i++) {
    int k = min(i + 1, n - i - 1);
    {
      long long cur = pref[i + 1] - pref[i + 1 - k];
      cur += suff[i + 1] - suff[i + 1 + k];
      cur *= 2;
      cur -= min(x[i], l - x[i + 1]);
      res = max(res, cur);
    }
    if (i + 1 > k) {
      long long cur = pref[i + 1] - pref[i + 1 - k - 1];
      cur += suff[i + 1] - suff[i + 1 + k];
      cur *= 2;
      cur -= x[i];
      res = max(res, cur);
    }
    if (n - i - 1 > k) {
      long long cur = pref[i + 1] - pref[i + 1 - k];
      cur += suff[i + 1] - suff[i + 1 + k + 1];
      cur *= 2;
      cur -= l - x[i + 1];
      res = max(res, cur);
    }
  }
  printf("%lld\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 4096
#include <stdio.h>

int main(void)
{
	int i;
	float mt;
	float max;
	float min;
	
	max = 0; min = 999999;
	while (scanf("%f", &mt) != EOF){
		if (mt > max){
			max = mt;
		}
		if (mt < min){
			min = mt;
		}
	}
	printf("%.1f\n", max - min);
	
	return (0);
}

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


using namespace std;
using ll = int64_t;
#define int int64_t

 
/* ==== declarations ====== */
// functions
void solve();
void getInput();
 
// global variables
int N, M;
vector<vector<int>> AL;
vector<int> D;
vector<int> ans;
const int INF = 1e9;

/* ======================== */
void getInput() {
    cin>>N>>M;
    AL = vector<vector<int>>(N, vector<int>());    
    D = vector<int>(N, INF);
    ans = vector<int>(N, -1);
    for(int i=0; i<M; ++i) {
        int u, v;
        cin>>u>>v;
        u--; v--;
        AL[u].push_back(v);
        AL[v].push_back(u);
    }
}
 
 
void solve() {
    // auto nb = AL[0];
    // print(nb);
    // queue<int> que;
    queue<pair<int, int>> que;
    que.push({0, 0});
    D[0] = 0;
    // print(D);
    // exit(0);

    while(!que.empty()) {
        auto op = que.front();
        que.pop();
        auto n = op.first;
        auto d = op.second;
        // D[n] = d;
        auto nb = AL[n];
        
        for(auto nn: nb) {
            if (D[nn] <= d+1) continue;
            D[nn] = d+1;
            que.push({nn, d+1});
            ans[nn] = n;
        }
    }
    // print(D);
    // print(ans);
    for (int i=1; i<N; ++i) {
        if (ans[i] == -1) {
            cout<<"No"<<endl;
            exit(0);
        }
    }
    cout<<"Yes"<<endl;
    for (int i=1; i<N; ++i)
        cout<<ans[i]+1<<endl;

}
 
 
 
signed main(){
    getInput();
    solve();
    return 0;
}

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

using namespace std;

int main(void){
  long long money = 100;
  long long x;
  cin >> x;
  int cnt = 0;
  while(money < x){
    money *= 1.01;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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

int N;
vector<int> F;

void input_init(void) {
	cin >> N;
	F.resize(N + 1, 0);
}

void solve(void) {
	for (int x = 1; x * x <= N; ++x) {
		for (int y = 1; y * y <= N; ++y) {
			for (int z = 1; z * z <= N; ++z) {
				int d = x * x + y * y + z * z + x * y + y * z + z * x;
				if (d <= N)
					++(F[d]);
			}
		}
	}
}

int main(void) {
	input_init();
	solve();
	for (int i = 1; i <= N; ++i)
		cout << F[i] << '\n';
	return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>

int main()
{
	int a, b;
	std::cin >> a >> b;

	int cnt = 0;
	for( int i = a; i <= b; i++ ) {
		std::string s;
		s = std::to_string( i );
		if( s[ 0 ] == s[ 4 ] and s[ 1 ] == s[ 3 ] ) {
			cnt += 1;
		}
	}

	std::cout << cnt << std::endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <iostream>
#include <fstream>

using namespace std;

const int DIV = 1000000007;

void execute(int test, istream &in) {
    int a, b;
    int v, w;
    int t;
    in >> a >> v >> b >> w >> t;
    int64_t dist = abs(a - b);
    bool yes = dist == 0;
    if (!yes) {
        int64_t can = v - w;
        if (can > 0) {
            can *= t;
            yes = can >= dist;
        }
    }
    printf(yes ? "YES" : "NO");
}

int main(int argc, char* argv[])
{
#ifdef VLAD_LOCAL
    //FILE *f = fopen("in.txt", "r");
    ifstream f("in.txt");
#else
    //FILE *f = stdin;
    istream &f = cin;
#endif
    int tests = 1;
    //f >> tests;
    for (int test = 0; test < tests; test++) {
        execute(test, f);
    }
    return 0;
}


Measured memory_bytes: 3764
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		if(a==b&& b==c) System.out.println("No");              
		else if(a==b || a==c || b==c) System.out.println("Yes");
		else System.out.println("No");
	}
}


Measured memory_bytes: 24916