akhauriyash/Code-Regression huggingface dataset:
import java.io.*;

public class Main{
    public static void main(String[] args) {
        int[] Ab = new int[26];
        for (int i = 0; i < 26; i++) {
            Ab[i] = 0;
        }
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        outer: try {
            while (true) {
                String s = reader.readLine();
                if(s == null)
                {
                    break outer;
                }
                s = s.replace(" ", "");
                for (int i = 0; i < s.length(); i++) {
                    char ch = s.toLowerCase().charAt(i);
                    if (97 > ch || ch > 122) {
                        continue;
                    }
                    Ab[(int) ch - 97] += 1;
                }
            }
        } catch (Exception e) {
            System.out.println(e);
        }
        for (int i = 0; i < 26; i++) {
            System.out.println((char) (i + 97) + " : " + Ab[i]);
        }
    }
}


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

using namespace std;

const int N = 1e2+7;

int n;

int main()
{
    cin >> n;
    for (int i = 1; i < 10; ++i) {
        for (int j = 1; j < 10; ++j) {
            if (i*j == n) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}


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

int main() {
	int n;
	cin>>n;
	vector<ll> a(n+1);
	ll sum=0;
	for(int i=1; i<=n; i++) 
	{
		cin>>a[i];
		sum+=a[i];
	}
	
	int q;
	cin>>q;
	while(q--)
	{
		ll p, x;
		cin>>p>>x;
		cout<< sum - a[p] + x<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define newl "\n"
using namespace std;
using lli = long long int;
using vvint = vector <vector <int>>;
const int mod = 1e9 + 7;

const int N = 2e5 + 1;

void solve(){
	int n,m;
	cin >> n >> m;
	vector <vector <pair <int,int>>> p(n + 1);
	for(int i = 0;i < m;++i){
		int P,Y;
		cin >> P >> Y;
		p[P].push_back({Y,i + 1});
	}
	vector <string> out(m + 1,"");
	for(int i = 1;i <= n;++i){
		sort(p[i].begin(),p[i].end());
		for(int j = 0;j < (int)p[i].size();++j){
			string i1 = to_string(i);
			string ap = "";
			for(int k= 0;k < 6 - (int)i1.length();++k){
				ap = ap + "0";
			}
			reverse(i1.begin(),i1.end());
			i1 = i1 + ap;
			ap = "";
			string j2 = to_string(j + 1);
			for(int k = 0;k < 6 - (int)j2.length();++k){
				ap = ap + "0";
			}
			reverse(j2.begin(),j2.end());
			j2 = j2 + ap;
			out[p[i][j].second] = j2 + i1;
			reverse(out[p[i][j].second].begin(),out[p[i][j].second].end());
		}
	}
	for(int i = 1;i <= m;++i) cout << out[i] << newl;
	return;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(10);
	#ifdef EXECUTE_LOCALLY
		   freopen("in.txt","r",stdin);
	#endif
	int t = 1;
	//cin >> t;
	while(t--) solve();
	#ifdef EXECUTE_LOCALLY
    	cout << setprecision(3) << "program time: " << (double)clock() / CLOCKS_PER_SEC << newl;
	#endif
	return 0;
}


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

int main(){
  int n; cin >> n;
  int s[n];
  int mod[10];
  for(int i=0; i<10; i++) mod[i] = 1000000;

  int sum=0;
  for(int i=0; i<n; i++){
    cin >> s[i];
    sum += s[i];
    mod[s[i]%10] = min(mod[s[i]%10], s[i]);
  }

  int mi=sum;
  for(int i=0; i<10; i++){
    if(sum%10 == i) continue;
    mi = min(mi, mod[i]);
  }

  cout << ((sum%10)? sum: sum-mi) << endl;

  return 0;

}


Measured memory_bytes: 256
//in the name of allah
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2002 , MOD=1e9+7;
int dp[N][N] , k;
int add(int a , int b){
    return (a+b)%MOD;
}
int solve(int n , int m){
    if(dp[n][m] >= 0)
        return dp[n][m];
    dp[n][m] = 0;
    for(int j=0 ; j<=min(n,k-1) ; j++)
        if((k-1)-j<=m)
            dp[n][m] = add(dp[n][m] , solve(n-j , m-((k-1)-j)));        
    return dp[n][m];
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n , m;cin >> n >> m >> k;m--;
    for(int i=0 ; i<=n ; i++)
        for(int j=0 ; j<=m ; j++)
            dp[i][j] = -1;
    dp[0][0] = 1;
    solve(n , m);
    int ans=0;
    for(int i=(n>0) ; i<=n ; i++)
        if( i%(k-1) == n%(k-1) )
            ans = add(ans , solve(i,m));        
    cout << ans << "\n";
}

Measured memory_bytes: 16128
n, m = map(int, input().split())
edge = [[False for j in range(n)] for i in range(n)]
for _ in range(m):
	a, b = map(int, input().split())
	edge[a-1][b-1] = edge[b-1][a-1] = True
visited = [False for _ in range(n)]
ans = 0
def dfs(v):
	visited[v] = True
	if all(x==True for x in visited):
		global ans
		ans += 1
		return
	for i in range(0, n):
		if edge[v][i]==True and visited[i]==False:
			dfs(i)
			visited[i] = False
dfs(0)
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    private static final String SUNNY = "Sunny";
    private static final String CLOUDY = "Cloudy";
    private static final String RAINY = "Rainy";

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        String S = scanner.next();

        switch (S) {
            case SUNNY:
                System.out.println(CLOUDY);
                return;
            case CLOUDY:
                System.out.println(RAINY);
                return;
            case RAINY:
                System.out.println(SUNNY);
                return;
        }
    }
}

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





int main() {

    int N,L;
    cin >> N >> L;

    vector<int> taste(N + 1);
    for(int i = 1; i <= N;i++) {
        taste.at(i) = i + L - 1; 
    }

    int ans = 0;
    if(L >= 0) {
        for(int i = 2; i <= N;i++) {
            ans += taste.at(i);
        }
        cout << ans << endl;
    }else {
        if(abs(L) >= N) {
            for(int i = 1;i < N;i++) {
                ans += taste.at(i);
            }
            cout << ans << endl;
        }else {
            for(int i = 1;i <= N;i++) {
                ans += taste.at(i);
            }
            cout << ans << endl;
        }
    }
}


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

#define For(i, j, k) for (int i = j; i <= k; i++)

using namespace std;

const int N = 2010;

typedef __int128 LL;

int n;
LL A[N][N];

int vis[N * 20], prm[N];

void init(int m) {
	int c = 0;
	For(i, 2, m) if (!vis[i]) {
		if (i != 2) prm[++c] = i;
		for (int j = i * 2; j <= m; j += i) vis[j] = true;
	}
}

LL gcd(LL x, LL y) {
	return !y ? x : gcd(y, x % y);
}

LL lcm(LL x, LL y) {
	return x * y / gcd(x, y);
}

int main() {

	scanf("%d", &n);

	if (n == 2) {
		puts("4 7\n23 10");
		return 0;
	}

	init(n * 20);

	int l = 1, r = n;
	for (int s = 2; s <= n * 2; s += 2) {
		int cur = s % 4 == 0 ? prm[l++] : prm[r--];
		For(i, 1, n) if (s - i >= 1 && s - i <= n)
			A[i][s - i] = cur;
	}
	l = n + 1, r = 2 * n;
	for (int s = n % 2 ? 2 : 3; s <= n * 2; s += 2) {
		int cur = s % 4 < 2 ? prm[l++] : prm[r--];
		For(i, 1, n) {
			int j = n + 1 + i - s;
			if (j >= 1 && j <= n) A[i][j] *= cur;
		}
	}

	For(i, 1, n) For(j, 1, n) if ((i + j) % 2) {
		LL S = 1;
		if (i > 1) S = lcm(S, A[i - 1][j]);
		if (j > 1) S = lcm(S, A[i][j - 1]);
		if (i < n) S = lcm(S, A[i + 1][j]);
		if (j < n) S = lcm(S, A[i][j + 1]);
		++S;
		A[i][j] = S;
	}

	For(i, 1, n) For(j, 1, n) printf("%lld%c", (long long)A[i][j], j == n ? '\n' : ' ');

	return 0;
}

Measured memory_bytes: 18176
/*
 * 2361.cc: Sort
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 8;

/* typedef */

typedef long long ll;
typedef pair<ll,int> pli;
typedef map<int,ll> mil;

/* global variables */

int cs[MAX_N][MAX_N];
mil dists;

/* subroutines */

inline int getb(int bits, int k) {
  return (bits >> (3 * k)) & 7;
}

inline int setb(int bits, int k, int v) {
  return (bits & ~(7 << (3 * k))) | (v << (3 * k));
}

/* main */

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

  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) cin >> cs[i][j];

  int st = 0;
  for (int i = 0; i < n; i++) st = setb(st, i, i);
  //printf("%x\n", st);

  dists[st] = 0;

  priority_queue<pli,vector<pli>,greater<pli> > q;
  q.push(pli(0, st));

  while (! q.empty()) {
    pli u = q.top(); q.pop();
    ll &ud = u.first;
    int &ui = u.second;
    if (ud != dists[ui]) continue;

    for (int i = 0; i < n; i++) {
      int bi = getb(ui, i);
      for (int j = i + 1; j < n; j++) {
	int bj = getb(ui, j);
	int vi = setb(setb(ui, i, bj), j, bi);
	ll vd = ud + cs[i][j];

	mil::iterator mit = dists.find(vi);
	if (mit == dists.end()) {
	  dists[vi] = vd;
	  q.push(pli(vd, vi));
	}
	else if (mit->second > vd) {
	  mit->second = vd;
	  q.push(pli(vd, vi));
	}
      }
    }
  }

  ll maxd = 0;
  for (mil::iterator mit = dists.begin(); mit != dists.end(); mit++)
    if (maxd < mit->second) maxd = mit->second;

  printf("%lld\n", maxd);
  return 0;
}

Measured memory_bytes: 4524
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

int main(int argc, const char * argv[]) {
    
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin >> s;
    
    ll n = s.size();
    
    vector<ll> ans(n);
    vector<ll> lr, rl;
    
    lr.push_back(-1);
    lr.push_back(n-1);
    
    for ( ll i = 0; i < n - 1; i++ ){
        if ( s[i] == 'R' && s[i+1] == 'L' ) rl.push_back(i);
        else if ( s[i] == 'L' && s[i+1] == 'R' ) lr.push_back(i);
    }
    
    sort(lr.begin(), lr.end());
    
    for ( ll i = 0; i < lr.size() - 1; i++ ){
        ll even = (lr[i+1] + 10) / 2 - (lr[i] + 10) / 2;
        ll odd = lr[i+1] - lr[i] - even;
        
        ans[rl[i]] = rl[i] % 2 ? odd : even;
        ans[rl[i] + 1] = rl[i] % 2 ? even : odd;
    }
    
    for (auto x : ans )
        cout << x << " ";
    
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 2372
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    int N, result = 0;
    cin >> N;
    REP(i, N) {
        result += i+1;
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

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

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> edges(n);
    for (int i = 0; i < m; ++i) {
        int u, v;
        cin >> u >> v;
        u--, v--;
        edges[u].emplace_back(v);
    }
    int mini = 100000;
    vector<int> ret;
    for (int i = 0; i < n; ++i) {
        queue<int> q;
        vector<int> rev(n, -1), dist(n, -1);
        q.push(i);
        dist[i] = 0;
        [&]() {
            while (!q.empty()) {
                int c = q.front();
                q.pop();
                for (auto &v : edges[c]) {
                    if (v == i) {
                        if (dist[c] < mini) {
                            chmin(mini, dist[c]);
                            rev[v]   = c;
                            ret      = {v};
                            int curr = v;
                            while (true) {
                                curr = rev[curr];
                                if (curr == v)
                                    break;
                                ret.push_back(curr);
                            }
                        }
                        return;
                    }
                    if (dist[v] != -1)
                        continue;

                    dist[v] = dist[c] + 1;
                    rev[v]  = c;
                    q.push(v);
                }
            }
        }();
    }
    if (!ret.empty()) {
        cout << ret.size() << "\n";
        for (auto &r : ret) {
            cout << r + 1 << "\n";
        }
    } else
        cout << -1 << "\n";
    return 0;
}

Measured memory_bytes: 384
#!/usr/bin/env python3
import sys

 
def main():
    N,M = map(int,input().split())
    ab = [list(map(int,input().split())) for _ in range(M)]
    ab.sort(key= lambda x: x[1])
    removed_bridge = 0
    answer = 0
    for aabb in ab:
        b = aabb[1]
        if removed_bridge<aabb[0]:
            removed_bridge = b-1
            answer+=1
    
    print(answer)
        



if __name__ == '__main__':
    main()


Measured memory_bytes: 29092
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N;
  cin >> N;
  
  for( int i = 0; i < 100; i++ ){
    for( int j = 0; j < 100; j++ ){
      if( 4*i + 7*j == N ){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
	Scanner in = new Scanner(System.in);

	int n = in.nextInt();

	for(int i=1; i<=n; i++){
	    if(times3(i)){
		System.out.print(" "+i);
	    }
	    else if(include3(i)){
		System.out.print(" "+i);
	    }
	}
	System.out.println();
    }

    public static boolean times3(int num){
	if(num%3==0)return true;
	else return false;
    }

    public static boolean include3(int num){
	while(num>0){
	    if(num%10==3)return true;
	    num/=10;
	}
	return false;
    }
}



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


int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  cout << max(a*b,c*d) << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;
const bool debug = 0;
//------------------------------//

int main() {
	int N, K;
	int x[100];
	cin >> N >> K;
	REP(i, N) scanf("%d", x + i);
	
	int ans = 0;
	REP(i, N) {
		ans += min(x[i] * 2, abs(K - x[i]) * 2);
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
package main

import (
	"fmt"
	"math"
	"sort"
)

func main() {
	var N int
	fmt.Scan(&N)
	x := make([]int, N)
	for i := 0; i < N; i++ {
		fmt.Scan(&x[i])
	}
	sort.Ints(x)
	r := math.MaxInt64
	for i := x[0]; i <= x[len(x)-1]; i++ {
		r = Min(r, calc(i, x))
	}
	fmt.Println(r)
}
func calc(n int, x []int) int {
	var w float64
	for i := 0; i < len(x); i++ {
		w += math.Pow(float64((n - x[i])), 2)
	}
	return int(w)
}
func Min(a, b int) int {
	if b < a {
		return b
	}
	return a
}


Measured memory_bytes: 512
#include<stdio.h>
int A[1000];
int cnt = 0;

int main(){
	int n,i,j,v,w,flag;
	scanf("%d",&n);
	
	for(i=0;i<n;i++){
		scanf("%d",&A[i]);
	}
	
	flag = 1;
	while(flag){
		flag = 0;
		for(j=n-1;j>0;j--){
			if(A[j] < A[j-1]){
				w=A[j];
				A[j]=A[j-1];
				A[j-1]=w;
				flag=1;
				cnt++;
			}

		}
	}
	
	for(i=0;i<n-1;i++)printf("%d ",A[i]);
	printf("%d\n",A[n-1]);
	printf("%d\n",cnt);
	
	
	
	
	return 0;
}

Measured memory_bytes: 1852
//Catchharsh
    #include<bits/stdc++.h>
    #define ll long long int 
    #define ld long double
    #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
    #define F first
    #define S second
    #define pb push_back
    #define endl '\n'
    const ll MOD = 1e9+7;
    const ll INF = 1011111111;
    const ll LLINF = 1000111000111000111LL;
    const ld EPS = 1e-10;
    const ld PI = 3.14159265358979323;
    using namespace std;
    ll power (int x,int n)
    {
        if(n==0)
        return 1;
        else if(n%2==0)
        return power((x*x),n/2);
        else
        return x*power((x*x),(n-1)/2); 
    }
    vector<ll> seve;
    void  seveprime()
    {
      int prime[1000000]={0};
      for(int i=2;i*i<1000000;i++)
       {
        if(prime[i]==0)
         {
      	  for(int j=i*2;j<=1000000;j+=i)
           prime[j]=1;
         }
       }
       for(int i=2;i<=1000000;i++)
       {
       	if(prime[i]==0)
       		seve.pb(i);
       }
    }
    ll ar[100005];
    int main()
    {   
         IOS;
         ll n,m,i,j,k,a,b;
         cin>>n>>m;
         for(i=0;i<m;i++)
         {
         	cin>>a>>b;
         	ar[a]++;
         	ar[b+1]--;
         }
         ll cnt=0;
         for(i=2;i<=n;i++)
         {
             ar[i]+=ar[i-1];
         }
         for(i=1;i<=n;i++)
         {
         	if(ar[i]==m)
         		cnt++;
         }
         cout<<cnt;
    }

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

int main()
{
   int H,W,N,b,c,max ;
    float a,i ;
   scanf("%d %d %d",&H,&W,&N) ;
   if(H>W)
    {
        max=H ;
    }
    else
    {
        max=W ;
    }
   a=N*1.00/max;

   b=(int)a ;
   i=b-a ;
   if(i==0)
    {
        printf("%d",b) ;
    }
    else
    {
        printf("%d",b+1) ;
    }

   return 0 ;
}


Measured memory_bytes: 128
//最小全域木したよ!!
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
#define INF ( 1 << 30 )
#define fr first
#define sc second
#define MAX_V 100
typedef pair<int,int> Pi;
typedef pair<int,Pi> Pii;
vector<vector<Pi> > info;
bool used[MAX_V];
int prim(){
  int total = 0;
  fill_n(used,MAX_V,false);
  priority_queue< Pi , vector<Pi> , greater<Pi> > que;
  que.push(Pi(0,0));
  while(!que.empty()){
    Pi p = que.top();
    que.pop();
    if(used[p.sc]++) continue;
    total += p.fr;
    for(int i = 0 ; i < info[p.sc].size() ; i++ ) que.push(info[p.sc][i]);
  }
  return total;
}
int main(){
  int n, m;
  while(cin >> n >> m, n){
    info.resize(n);
    for(int i = 0 ; i < m ; i++ ){
      int a,b,cost;
      cin >> a >> b >> cost;
      info[a].push_back(Pi(cost,b));
      info[b].push_back(Pi(cost,a));
    }
    cout << prim() << endl;
    info.clear();
  }
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fr first
#define sc second
#define ll  long long
#define mp make_pair
#define mod 1000000007

using namespace std;

ll x[100100];
ll y[100100];

int main(){
    int n,m;
    cin>>n>>m;
    for(int i=0 ; i<n ; i++){
        scanf("%lld",&x[i]);
    }
    for(int i=0 ; i<m ; i++){
        scanf("%lld",&y[i]);
    }
    ll s = x[0];
    s %= mod;
    s += mod;
    s %= mod;

    ll r= 0;
    for(ll i=1 ;i<n ;i ++){
        ll r1 = (x[i]*i)%mod;
        r1 -= s;
        r1 %= mod;
        r1 += mod;
        r1 %= mod;
        r += r1;
        r %= mod;
        s += x[i];
        s %= mod;
        s += mod;
        s %= mod;
    }
    ll res = 0;
    s = y[0];
    s %= mod;
    s += mod;
    s %= mod;

    for(ll i=1 ;i<m ;i ++){
        ll r1 = (y[i]*i)%mod;
        r1 -= s;
        r1 %= mod;
        r1 += mod;
        r1 %= mod;
        res += (r*r1)%mod;
        res %= mod;
        s += y[i];
        s %= mod;
        s += mod;
        s %= mod;
    }
    cout<<res<<endl;

    return 0;
}


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

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i < b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = INT_MAX / 2;
const ll  inf = LLONG_MAX / 2;
const int mod = 1000000007;
const int MAX_N = 101010;
const long double PI = acos(-1);

int MAX = 1000000000;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

	ll n, k, s;
	cin >> n >> k >> s;

	vector<int> ans(n);
	if (s == MAX) {
		REP(i, 0, k) {
			ans[i] = MAX;
		}
		REP(i, k, n) {
			ans[i] = 1;
		}
	}
	else {
		REP(i, 0, k) {
			ans[i] = s;
		}
		REP(i, k, n) {
			ans[i] = MAX;
		}
	}

	rep(i, n) {
		cout << ans[i] << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 1792
#include <iostream>

using namespace std;

string s;
char ch;

inline bool check(int a, int b, int c)
{
    if (s[a] == s[b] && s[a] == s[c] && s[a] != 's') {
        ch = s[a];
        return true;
    }
    else
        return false;
}

int main()
{
    while (cin >> s) {
        ch = 'd';

        if (check(0, 1, 2) || check(3, 4, 5) || check(6, 7, 8)
            || check(0, 3, 6) || check(1, 4, 7) || check(2, 5, 8)
            || check(0, 4, 8) || check(2, 4, 6))
            cout << ch << endl;
        else
            cout << ch << endl;
    }

    return 0;
}

Measured memory_bytes: 1172
Imports System

class Program
    shared sub main ()
        dim t() as String = Console.ReadLine().Split(" ")
        dim a as Int32 = Int32.Parse(t(0))
        dim b as Int32 = Int32.Parse(t(1))
        dim c as Int32 = Int32.Parse(t(2))
        Console.WriteLine(b + Math.Min(c, a + b + 1))
    end sub
end class

Measured memory_bytes: 11092
#include<iostream>
#include<string>
using namespace std;
int main(){
  string w;
  string t;
  cin >> w;
  int i;
  for(i=0;i<w.size();i++) {
    if('A'<=w[i]&&w[i]<='Z') w[i]+='a'-'A';
  }
  int o=0;
  cin >> t;
  while(t!="END_OF_TEXT"){
  
    for(i=0;i<t.size();i++) {
      if('A'<=t[i]&&t[i]<='Z') t[i]+='a'-'A';
    }
    if(w==t) o++;
    cin >> t;
  }
  cout << o << endl;
}



Measured memory_bytes: 3136
N,M=list(map(int,input().split()))
edge=[list(map(int,input().split())) for _ in range(M)]

current=N*(N-1)//2
ret=[0]*M

par=list(range(N+1))
cnt=[1]*(N+1)
rank=[0]*(N+1)

def find(x):
    if x==par[x]:
        return x
    else:
        par[x]=find(par[x])
        return par[x]

def same(x,y):
    return find(x)==find(y)

def size(x):
    return cnt[find(x)]

def unite(x,y):
    x=find(x)
    y=find(y)

    if x==y:
        return 0
    
    if rank[x]<rank[y]:
        cnt[y]+=size(x)
        par[x]=y
    else:
        cnt[x]+=size(y)
        par[y]=x
        if rank[x]==rank[y]:rank[x]+=1


for i in range(M-1,-1,-1):
    ret[i]=current

    a,b=edge[i]

    if not same(a,b):
        current-=size(a)*size(b)
        unite(a,b)

for r in ret:
    print(r)

Measured memory_bytes: 111192
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
    int x; cin >> x;
    if (x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    string s;
    cin>>s;
    s[3]='8';
    cout<<s<<endl;

    return 0;
}


Measured memory_bytes: 3616
#include <bits//stdc++.h>
using namespace std;
struct Point{
    vector<int> v;
    int length=0;
    int frag=0;
};
int main(void){
    int i,j,a,b,c,d;
    cin>>a>>b;
    Point points[a];
    for(i=0;i<b;i++){
        cin>>c>>d;
        points[d-1].v.push_back(c-1);
        points[c-1].frag++;
    }
    vector<int> start;
    for(i=0;i<a;i++){
        if(points[i].frag==0)
        start.push_back(i);
    }
    queue<int> q;
    for(i=0;i<start.size();i++){
        q.push(start[i]);
    }
        while(q.empty()==false){
            int p=q.front();
            q.pop();
            for(j=0;j<points[p].v.size();j++){
                int r=points[p].v[j];
                points[r].frag--;
                if(points[r].length<points[p].length+1){
                    points[r].length=points[p].length+1;
                }
                if(points[r].frag==0)
                    q.push(r);
            }
        }
        
    
    int ans=0;
    for(i=0;i<a;i++){
        if(ans<points[i].length)
        ans=points[i].length;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 6528
#include<bits/stdc++.h>
using namespace std;
int main()
{
  	string s,t;
  	cin>>s>>t;
  	if(s.length()+1==t.length())
  	{
  	    string x=t.substr(0,t.length()-1);
  	    if(s==x)
  	        cout<<"Yes"<<endl;
  	     else
  	        cout<<"No"<<endl;  
  	}
  	else
  	{
  	    cout<<"No"<<endl;
  	}
  	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i(0);i<n;++i)
 
int main() { 
    string s;
    cin >> s;
    s = "*" + s;
    ll dp[s.size()+2][2] = {};
 
    rep(i, s.size()) {
        if (s[i] != s[i+1]) dp[i+1][0] = max(dp[i+1][0], dp[i][0]+1);
        dp[i+1][0] = max(dp[i+1][0], dp[i][1]+1);
        dp[i+2][1] = max(dp[i+2][1], dp[i][0]+1);
    }
    cout << max(dp[s.size()-1][0], dp[s.size()-1][1]) << endl;
    return 0;
}

Measured memory_bytes: 3648
// https://beta.atcoder.jp/contests/abc110
// status: [review]

#define SUBMIT

#include <bits/stdc++.h>
using namespace std;

int main() {
#ifdef SUBMIT
    auto& in = cin;
#else
    stringstream in(R"(azzel
apple
)");
#endif
    string S, T;
    in >> S >> T;

    bool ok = true;
    map<char, char> ma, ima;
    for (int i = 0; i < S.size(); ++i) {
        auto s = S[i], t = T[i];
        if (ma.count(s)) if (ma[s] != t) ok = false;
        if (ima.count(t)) if (ima[t] != s) ok = false;
        ma[s] = t, ima[t] = s;
    }
    if (ok) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 776
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define lb(x) (x&-(x))
const int N = 101010;


int n,m,r;
int aim[9];
struct edge
{
	int to,next;
	int cost;
} g[40005];
int head[205],tol;
int dis[205][205];
int totedge=0;

void add(int u,int v,int c)
{	
	dis[u][v]=c;
	dis[v][u]=c;
}
void init()
{
	for(int i=0;i<=200;i++)
	for(int j=0;j<=200;j++)
	dis[i][j]=1000000000;
}
void floyd()
{
	for(int k=1;k<=n;k++)
	for(int u=1;u<=n;u++)
	for(int v=1;v<=n;v++)
	{	
		dis[u][v]=min(dis[u][v],dis[u][k]+dis[k][v]);
	}
	
}
int givedis(int s,int e)
{
	return dis[s][e];
}
int minn=1000000000;
int main(){

	int tot;
	int tmp1,tmp2,tmp3;
	cin>>n>>m>>r;
	init();
	for(int i=1;i<=r;i++)
	{
		cin>>aim[i];
	}
	for(int i=0;i<m;i++)
	{
		scanf("%d%d%d",&tmp1,&tmp2,&tmp3);
		add(tmp1,tmp2,tmp3);
	}
	floyd();
	sort(aim+1,aim+1+r);
	do
	{
	tot=0;
//	for(int i=1;i<=r;i++)
//	cout<<aim[i]<<" ";	
//	cout<<endl;	
	for(int i=1;i<=r-1;i++)
	{
	tot+=givedis(aim[i],aim[i+1]);
//	for(int i=1;i<=r;i++)
//	{
//		cout<<aim[i]<<" ";
//	}
	}
//	cout<<endl;
	if(minn>tot) minn=tot;
	}
	while(next_permutation(aim+1,aim+1+r));
	cout<<minn<<endl; 

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    string s;
    cin >> s;
    ll n = (ll)s.size();
    ll dp[20][2];
    dp[0][1] = s[0] - '1';
    dp[0][0] = s[0] - '0';
    rep(d, 0, n) {
        dp[d+1][0] = dp[d][0] + (s[d+1] - '0');
        dp[d+1][1] = max(dp[d][1] + 9, dp[d][0] + (s[d+1] - '1'));
    }
    cout << max(dp[n-1][0], dp[n-1][1]) << endl;
}

Measured memory_bytes: 256
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        s: String
    }
    let v: Vec<char> = s.chars().collect();
    if v[2] == v[3] && v[4] == v[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 2188
#include <iostream>

using namespace std;
int N, h[100005], dp[100005]{0};

int main()
{
    cin >> N;
    for(int i = 0; i < N; i++)
        cin >> h[i];
    if(N > 1)
        dp[1] = abs(h[1] - h[0]);
    for(int i = 2; i < N; i++)
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]));
    cout << dp[N-1] << '\n';
    return 0;
}


Measured memory_bytes: 4348
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

map<ll, int> PrimeFactor(ll n){
    map<ll,int> ret;
    for(ll i=2;i*i<=n;i++){
        while(n%i==0){
            ret[i]++;
            n/=i;
        }
    }
    if(n!=1) ret[n]=1;
    return ret;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    ll n;cin>>n;
    auto mp=PrimeFactor(n);

    ll ans=0;
    for(auto p:mp){
        ll rem=p.second;
        for(int i=1;rem>0;i++){
            ans++;
            rem-=i;
        }
        if(rem<0) ans--;
    }
    cout<<ans<<endl;
    return 0;
}


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

int main() {
    int n,ans=0;
    ll d;
    cin>>n>>d;
    d*=d;
    ll x,y;
    rep(i,0,n){
        cin>>x>>y;
        ull tmp=x*x+y*y;
        if(tmp<=d)
            ans++;
    }
    cout<<ans<<endl;


}



Measured memory_bytes: 3664
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "functional"
#include "ctime"

using namespace std;

//constexpr long long int MOD = 1000000007;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	cin >> N;
	cout << N * (N - 1) / 2 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<numeric>
#include<string>
#include<algorithm>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<n;i++)
#define int64 long long
#define yokuwaruprime (10*10*10*10*10*10*10*10*10+7)
using namespace std;

int main(){
  int N;
  string s;
  cin>>N>>s;
  int counteast;
  rep1(i,N){
    if(s[i]=='E'){
      counteast++;
    }
  }
  int left[N],right[N];
  left[0]=0;
  right[0]=counteast;
  rep1(i,N){
    if(s[i-1]=='W'){
      left[i]=left[i-1]+1;
    }else{
      left[i]=left[i-1];
    }
    if(s[i]=='E'){
      right[i]=right[i-1]-1;
    }else{
      right[i]=right[i-1];
    }
  }
  int ans=counteast;
  rep(i,N){
    if(left[i]+right[i]<ans){
      ans=left[i]+right[i];
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 2948
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pii;
const ll maxn = 1e6+10;
const ll inf = 1e14;

vector<pii> ve[maxn];
ll dis[maxn];
priority_queue<pii,vector<pii>,greater<pii> > heap;
int N,M;

void init(){
	for(int i = 1;i<=N;i++) dis[i] = inf;
	for(int i = 1;i<=N;i++) ve[i].push_back({0,i-1});
	
}

ll Dji(){
	heap.push({0,1});
	dis[1] = 0;
	
	while(heap.size()){
		auto cur = heap.top();heap.pop();
		ll d = cur.first,id = cur.second;
		for(auto v:ve[id]){
			ll w = v.first,id2 = v.second;
			if(d+w<dis[id2]){
				dis[id2] = d+w;
				heap.push({dis[id2],id2});
			}
		}
	}
	if(dis[N] == inf) return -1;
	return dis[N];
}

int main(){
	cin>>N>>M;
	init();
	int a,b,c;
	for(int i = 0;i<M;i++){
		scanf("%d%d%d",&a,&b,&c);
		ve[a].push_back({c,b});
	}
	cout<<Dji()<<endl;
	return 0;
}

Measured memory_bytes: 32888
using System;

class alds1Aa
{
    static int[] fibos = new int[45];
    static void Main()
    {
        fibos[0] = 1;
        fibos[1] = 1;
        Console.WriteLine(fibo(int.Parse(Console.ReadLine())));
    }
    static int fibo(int n)
    {
        if (fibos[n]==0)
        {
            fibos[n] = fibo(n-1)+fibo(n-2);
        }
        return fibos[n];
    }
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

template<typename T>
void chmin(T &a, T b) {
    a = min(a, b);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string str;
    cin >> str;
    vector<int> black(n + 1, 0), white(n + 1, 0);
    REP (i, 0, n) {
        black[i + 1] += black[i] + (str[i] == '#');
        white[n - i - 1] += white[n - i] + (str[n - i - 1] == '.');
    }
    REP (i, 0, n + 1) {
        //cout << black[i] << " " << white[i] << endl;
    }
    int ans = 1 << 30;
    REP (i, 0, n + 1) {
        chmin(ans, black[i] + white[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2196
import math
#from scipy.special import comb

def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: 
        return 1
    if r%2 == 0:
        return power(n*n%mod,r//2,mod)%mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

x,y = map(int,input().split())


ans = 0
md = 10**9+7
if((x+y)%3 != 0 or (2*y-x)%3 != 0 or (2*x-y)%3 != 0 or 2*y-x < 0 or 2*x-y < 0):
    print(0)
else:
    a = (2*x - y)//3
    n = (x+y)//3
    ans = comb(n,a,md)
    print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;

int main(){
	double r,A,l;
	cin >> r;
	A=(r*r)*M_PI;
	l=(r*2)*M_PI;
	cout << fixed << A <<' '<< l << endl;
	return 0;
}

Measured memory_bytes: 3236
import java.util.*;
import java.io.*;
public class Main {
    public static void main (String[] args){
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> num = new ArrayList<>();
        while(sc.hasNext()){
            num.add(sc.nextInt());
        }
        int listSize = num.size()-1;
        for(int i=0;i<listSize;i++){
            for(int j=0;j<(listSize)-i;j++){
                // j番目とj+1番目の要素を比較して
                // j番目の方が大きかったとき、2つの要素を入れ替える
                if(num.get(j)>num.get(j+1)){
                    int x = num.get(j);
                    int y = num.get(j+1);
                    num.set(j,y);
                    num.set(j+1,x);
                }
            }
        }
        for(int k=0;k<num.size();k++){
            if(k==num.size()-1){System.out.println(num.get(k));}
            else{System.out.print(num.get(k) + " ");}
        }
    }
}

Measured memory_bytes: 25968
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define vi vector<int>
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define pii pair<int,int>
#define mp make_pair
#define pi 3.14159265359
#define shosu(X) fixed << setprecision(X)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll int makemin(ll int in){
	ll int rst = 0;
	int keta = log10(in)+1;
	vi tmp;
	ll int in2 = in;
	while(in2>0){
		tmp.pb(in2%10);
		in2/=10;
	}
	sort(All(tmp));
	REP(i,tmp.size()){
		rst+=tmp[i];
		if(i!=tmp.size()-1) rst*=10;
	}
	return rst;
}

ll int makemax(ll int in){
	ll int rst = 0;
	int keta = log10(in)+1;
	vi tmp;
	ll int in2 = in;
	while(in2>0){
		tmp.pb(in2%10);
		in2/=10;
	}
	sort(All(tmp),greater<int>());
	REP(i,tmp.size()){
		rst+=tmp[i];
		if(i!=tmp.size()-1) rst*=10;
	}
	return rst;
}

int main(){
	while(1){
		ll int in,keta;
		cin >> in >> keta;
		if(in==0&&keta==0) break;
		vector<ll int> data;
		data.pb(in);
		ll int cnt = 0;
		ll int ans,ans2;
		while(1){
			ll in2 = in;
			REP(i,keta-(int)(log10(in2))-1) in*=10;
			ll int tmp = makemax(in)-makemin(in);
			REP(i,data.size()){
				if(data[i]==tmp) {
					ans = i;
					ans2 = tmp;
					goto end;
				}
			}
			//cout << in << " ";
			in = tmp;
			cnt++;
			data.pb(tmp);

		}
		end:
		cout << ans << " " << ans2 << " " << cnt-ans+1 << endl;
	}
}

Measured memory_bytes: 1264
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long long i = 0;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define Sort(v, n) sort(v, v+n);
#define VSort(v) sort(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define cY cout<<"Yes";
#define cN cout<<"No";
#define cA(a) cout<<a;
const ll MOD = 1000000007;



int main() {
    int a,b;cin >> a >> b;
    int ans = a+b;
    ans = max(ans,a-b);
    ans = max(ans,a*b);
    cout << ans;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,k;
  cin>>n>>k;
  if(n>=k && n%2==1 && (n+1)/2>=k)
    cout<<"YES"<<endl;
  else if(n>=k && n/2>=k)
    cout<<"YES"<<endl;
  else
    cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n, count;
    string s;
    cin >> n >> s;
    
    for (int i = 0; i < 1000; i++){
        vector<int> vec = { i / 100, (i/10) % 10, i%10};
        int rank = 0;
        for (int j = 0; j < n; j++){
            if(s.at(j) == '0' + vec.at(rank)) rank++;
            if(rank == 3) {
                count++;
                break;
            }
        }
    }
    printf("%d\n",count);
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    vector<int> a(5);
    rep(i, 0, 5){
        cin >> a[i];
    }
    int k;
    cin >> k;
    rep(i, 0, 5){
        rep(j, i+1, 5){
            if(abs(a[j] - a[i]) > k){
                cout << ":(" << endl;
                return 0;
            }
        }
    }
    cout << "Yay!" << endl;
    return 0;
}


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

ll func(ll a, ll b) {
	ll temp;
	if (a < b) {
		temp = a;
		a = b;
		b = temp;
	}
	while (b != 0) {
		temp = a % b;
		a = b;
		b = temp;
	}
	return a;
}

int main()
{
    ll n, x;
    cin>>n>>x;
    ll t = func(n, x);
    n /= t;
    x /= t;
    ll ans = (n - 1)*3 * t;
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define ll long long
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int cnt = 0;
    while (n > 0) {
        if ((n%10) == 2) {
            cnt++;
        }
        n /= 10;
    }
    cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
N , M = map(int,input().split()) 
ab = [list(map(int,input().split())) for _ in range(M)]
flg = True
ch = [0] * N
gl = [[0] * N for _ in range(N)] 
# 隣接行列を作成する
for x in ab:
    gl[x[0]-1][x[1]-1] = 1
    gl[x[1]-1][x[0]-1] = 1
# パスが１つしかない頂点のパスは橋である
# 橋と橋以外のパスが１本しかない頂点の橋以外のパスも橋である
# 隣接行列を更新しながら各頂点についてチェックを繰り返せばよい
count = 0
while flg:
    flg = False
    for i in range(N):
        if (ch[i] == 0 )and (sum(gl[i]) == 1):
            ch[i] = 1
            count += 1
            flg = True
            for j in range(N):
                if gl[i][j] == 1:
                    gl[j][i] = 0
print(count)

Measured memory_bytes: 3064
x = int(input())

for a in range(10**4):
    for b in range(10**4):
        if(a**5 + b**5 == x):
            print(a, -b)
            break
        elif(a**5 - b**5 == x):
            print(a, b)
            break
    else:
        continue
    break

Measured memory_bytes: 9100
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define case(i) cout<<"Case #"<<i<<": "
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const ll INF = 1e18;

ll n; vector<vector<ll>> dp; vector<ll> a;
ll ans(int x, int y) {
	if (dp[x][y] != -INF) return dp[x][y];
	if (x == y) return dp[x][y] = a[x];
	else return dp[x][y] = max(a[x] - ans(x + 1, y), a[y] - ans(x, y - 1));
}

int main() { 
	cin >> n; a.resize(n);
	rep(i, 0, n) cin >> a[i];
	dp.resize(n);
	rep(i, 0, n) dp[i].resize(n,-INF);
	cout << ans(0, n - 1) << endl;
	return 0;
}

Measured memory_bytes: 70784
// https://atcoder.jp/contests/abc137/tasks/abc137_a
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define LEN(x) (sizeof(x) / sizeof(*(x)))
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    cout << max({a + b, a - b, a * b}) << endl;

    return 0;
}


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


int keta(int n) {
    if (n/100 >= 1) {
        return 3;
    }
    else if (n/10 >= 1) {
        return 2;
    }
    else {
        return 1;
    }
}


int main() {
    int a, b;
    cin >> a >> b;
    int k = keta(b);
    int n = a * pow(10, k) + b;

    string ans = "No";
    for (int i=1; i<1000; i++) {
        if (n == (i*i)) {
            ans = "Yes";
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define ALL(v) v.begin(), v.end()
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
	int N;
	string S;
	cin >> N >> S;
	int ans = 0;
	int cnt = 0;
	for(char s: S) {
		if (s=='I') ++cnt;
		if (s=='D') --cnt;
		ans = max(ans ,cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define ctoi(c) c - '0'
#define tos(s) to_string(s)

typedef long long ll;


int main() {
    ll n;
    cin >> n;
    ll a[n], b[n];
    rep(i,n) {
        cin >> a[i] >> b[i];
    }
    sort(a, a+n);
    sort(b, b+n);
    if (n%2==0) {
        cout << b[n/2-1]+b[n/2] - a[n/2-1]-a[n/2] + 1 << endl;
    } else {
        cout << b[(n+1)/2-1] - a[(n+1)/2-1] + 1 << endl;
    }
    return 0;
}

/*
ACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACACAC                                                                              
                                   ******,  .,, .,, ,,,    ****.**              
                                   ** . .,,,,,,,,,,,,,,,,,,,,,. .,*             
                                   **,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.            
                                .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.        
                                .,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.        
                    ****      ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,      
              ***************,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,    
         ********************,,,,,,,,,,,,,,@@@,,,,,,,,,,,/@@@,,,,,,,,,,,,,,,    
        ******************,,,,,,,,,,,,,,,,,,(,,.         ,,,,,,,,,,,,,,,,,,,    
       ********************,,,,,,,,,,,*,,,,,.     %&&&     .,,,,*,,,,,,,,,,,,.  
       ***,,,,,,,,,,,,,,*,,,,,,,,,,,,,,,,,,,,               ,,,,,,,,,,,,,,,,,   
       ,,,,,,,,,,,,,,,,,,,**,,,,,,,,,,.......      ##(     ........,,,,,,,,,,.  
     .,,,,,,,,,,,,,,,,,,**,,,,,,,,,,..............    ..............,,,,,,,,    
    .,,,,,,,,,,,,,,,,,,,**,,,,,,,,,.................................,,,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,***,,,,,,,....................................,,,,,,,,,  
   ,,,,,,,,,,,,,,,,,,,,**,,,,,,,,.....................................,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,,**,,,,,,,,....................................,,,,,,,   
   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................................,,,,,     
   ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................................,.,,,,,     
    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,.....................................,,,        
     ,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................................,,,        
      ,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................................,          
       ..,,,,,,,,,,,,,,,,,,,,,,,,,,.................................,           
       .........**.....       ,,,,,..............................               
        .......*......                  ****,**,       ,..****                  
        .......*,....                   .......        ......                   
          .......*....                   .....          .....                   
                                         ......          .....                  
*/

Measured memory_bytes: 6284