akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <deque>

using namespace std;

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

typedef long long ll;

int main() {
    string s,t;
    cin >> s >> t;
    int count, tmp;
    count = 1000;
    for (int i=0; i < (s.length()-t.length()+1); i++) {
        tmp = t.length();
        for(int j=0; j< t.length(); j++) {
            if (s[i+j]==t[j]) {
                tmp--;
            }
        }
        count = min(count, tmp);
    }
    cout << count << endl;
    return 0;
}

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

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

typedef long long ll;
typedef int64_t i6;

#define rep(i, n) for (ll i = 0; i < n; ++i)
#define Sort(x) sort(x.begin(), x.end())
#define Sort_rev(x) sort(x.begin(), x.end(), greater<int>())
#define ALL(v) (v).begin(), (v).end()

//π M_PI
//deg = rad*180/M_PI

ll func( ll a , ll ans ) {
    // cout << "a " << ans << endl;
    if ( a <= 1 ) {
        ans++;
        // cout << "b " << ans << endl;
    } else {
        // ans++;
        // cout << "c " << ans << endl;
        ans = 2*func(a/2, ans)+1;
        // ans = func(a/2, ans);
        // cout << "d " << ans << endl;
        // func(a/2, ans);
    }

    return ans;
}

int main() {
    ll h;
    cin >> h;
    ll ans = 0;
    ans = func(h, ans);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (4) << f << endl; Prints x.xxxx


using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   

int main(){
	std::ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	if(a==1){
		a+=20;
	}
	if(b==1){
		b+=20;
	}
	if(a>b)
		cout<<"Alice";
	if(a<b)
		cout<<"Bob";
	if(a==b)
		cout<<"Draw";
}


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

void solve(){
    ll n, x;
    cin >> n >> x;
    if(x == 1 || x == 2*n-1){
        cout << "No" <<endl;
        return;
    }
    cout << "Yes" << endl;
    for(ll i = 0; i <2*n-1; ++i){
        if((x+n+i)%(2*n-1) == 0) cout << 2*n-1 << endl;
        else cout << (x+n+i)%(2*n-1) << endl;
    }
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  //int t;cin>>t;while(t--)
  solve();
  return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<math.h>
#include<map>
#include<unordered_map> 
#include<vector>
#include<queue>
#include<set>

#include<deque> 
#include<bitset>
#include<string>
#define N 40
#define K 300005
#define MOD 1e9+7
#define int long long 
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;




int mod = 1e9 + 7;
int lim = 55;
vector<vector<int>>mat(lim, vector<int>(lim,0));
vector<vector<int>>mat1(lim, vector<int>(lim,0));
vector<vector<int>>ans(lim, vector<int>(lim,0));

vector<vector<int>> pro(){
	vector<vector<int>> ree(lim, vector<int>(lim,0));
	for(int i=0;i<lim;i++){
		for(int j=0;j<lim;j++){
			int t = 0;
			for(int k = 0; k<lim;k++){
				t += (mat1[i][k] * mat1[k][j]);
				if(t >= mod)
					t %= mod;
			}
			ree[i][j] = t;
		}
	}
	return ree;
}
				
vector<vector<int>>pro1(){
	vector<vector<int>> ree(lim, vector<int>(lim));
	for(int i=0;i<lim;i++){
		for(int j = 0; j<lim;j++){
			int t = 0;
			for(int k=0;k<lim;k++){
				t += (ans[i][k] * mat[k][j]);
				if(t >= mod)
					t %= mod;
			}
			ree[i][j] = t;
		}
	}
	return ree;
}
vector<vector<int>> solve(int p){
	if(p == 1){
		return mat;
	}
	
	mat1 = solve(p/2);
	ans = pro();
	if(p %2 == 0)
		return ans;
	else
		return pro1();
}
	

int32_t main(){
	int n, k;
	cin>>n>>k;
    if(n == 1){
        cout<<0;
        return 0;
    }
    
    
	
	vector<int>col(lim,0);
	

	int tot = 0;
	for(int i=0;i<n;i++){
		int o = 0;
		for(int j=0;j<n;j++){
			cin>>mat[i][j];
			o += mat[i][j];
		}
		col[i] = o;
		tot += o;
	}
	if(k == 1){
		cout<<tot;
		return 0;
	}
	
	vector<vector<int>>res(lim, vector<int>(lim,0));
	res = solve(k-1);

	int for_each[lim];
    
	for(int i=0;i<lim;i++){
		for_each[i] = 0;
		int t = 0;
		for(int j = 0; j<lim; j++){
			t += (res[i][j] * col[j]);
			if(t >= mod)
				t %= mod;
		}
		for_each[i] = t;
	}
	int ans1 = 0;
	for(int i=0;i<lim;i++){
		ans1 += for_each[i];
		if(ans1 >= mod)
			ans1 -= mod;
	}
	cout<<ans1<<endl;
		
	
	
}



Measured memory_bytes: 384
using System;
using System.Linq;

class MainClass
{
    public static void Main()
    {
        for (; ; )
        {
            var inputs = Console.ReadLine().Split(' ');
            var nums = Array.ConvertAll(inputs, int.Parse);

            int h = nums[0], w = nums[1];

            if (h == 0 && w == 0)
                break;

            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    if (i % 2 == 1)
                    {
                        if (j % 2 == 1)
                            Console.Write('#');
                        else
                            Console.Write('.');
                    }
                    else
                    {
                        if (j % 2 == 1)
                            Console.Write('.');
                        else
                            Console.Write('#');
                    }
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
}

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

#define ll long long int
#define All(a) (a).begin(),(a).end()

void solve(){
  int n,m;
  scanf("%d %d",&n,&m);
  char A[n][m];
  vector<vector<int>> ans(n+2,vector<int>(m+2,0));
  for(int i=0;i<n;i++){
    for (int  j = 0; j < m; j++){
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < n; i++){
    for (int  j = 0; j < m; j++){
      if(A[i][j]=='#'){
        ans.at(i).at(j)+=1;
        ans.at(i).at(j+1)+=1;
        ans.at(i).at(j+2)+=1;
        ans.at(i+1).at(j)+=1;
        ans.at(i+1).at(j+1)+=1;
        ans.at(i+1).at(j+2)+=1;
        ans.at(i+2).at(j)+=1;
        ans.at(i+2).at(j+1)+=1;
        ans.at(i+2).at(j+2)+=1;
      }
    }
  }
  for(int i=0;i<n;i++){
    for (int j = 0; j < m; j++)
    {
       if(A[i][j]=='#'){
         printf("#");
       }else{
          printf("%c",'0'+ans[i+1][j+1]);
      }
    }
    printf("\n");
    
  }
}
int main(){
  solve();
  return 0;
}

Measured memory_bytes: 3676
#include<cstdio>
#include<iostream>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<cassert>
#include<sstream>
#include<cmath>
#include<algorithm>
#include<queue>
#include<limits>
#include<ctime>
#include<stack>
#include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	if(n%1000==0){
		cout<<0;
	}
	else{
		cout<<1000-n%1000;
	}
}

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

int main() {
	int r, g, b;
	cin >> r >> g >> b;
	int num = r * 100 + g * 10 + b;
	if (num % 4 == 0)cout << "YES";
	else cout << "NO";
}

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

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

    int ans = 0;
    while (1) {
        if (ans % (a + b) <= a && ans % 60 == c) {
            cout << ans << endl;
            break;
        }

        ans++;

        if (ans > 10000) {
            cout << -1 << endl;
            break;
        }
    }

    return 0;
}



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

int v1, v2, v3, v4, v5;
vector<int> v;
int T;

int order_time(int x){
    for (int i = 0; i <= 65; i++){
        if (x <= 10*i){
            x = 10*i;
            break;
        }
    }
    return x;
}

vector<int> det_turn(vector<int> x){
    for (int i = 1; i <= 9; i++){
        for (int j = 0; j < 5; j++){
            if (x[j] % 10 == i){
                swap(x[j], x[4]);
                goto end_loop;
            }
        }
    }
    end_loop:
    return x;
}

int main(){
    cin >> v1 >> v2 >> v3 >> v4 >> v5;
    vector<int> v = {v1, v2, v3, v4, v5};
    if (*min_element(v.begin(), v.end()) < 1 || *max_element(v.begin(), v.end()) > 123){
        exit(0);
    }
    
    v = det_turn(v);
    //for(int i = 0; i < v.size(); i++){
    //    cout << v[i] << ' ';
    //}
    //cout << endl;
    //cout << order_time(v1) + order_time(v2) + order_time(v3) + order_time(v4) + order_time(v5) << endl;
    for (int i = 0; i < 4; i++){
        T += order_time(v[i]);
    }
    T += v[4];
    cout << T << endl;
    return 0;
}

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

using namespace std;
typedef long long ll;


const int N=1e5+100;


int main()
{
    ll x;cin>>x;
    ll ans=0;
    ll kk=100;
    for(int i=1;;i++){
        kk=kk*1.01;
        ans++;
        if(kk>=x) break;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3636
//To debug :  g++ -g file.cpp -o code
//to flush output : fflush(stdout) or cout.flush()
//cout<<setprecision(p)<<fixed<<var
//use 1LL<<i to for 64 bit shifting , (ll)2 because by default 2 is ll
 
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,a,n) for(i=a;i<n;++i)
#define irep(i,n,a) for(i=n;i>a;--i)
#define mod 1000000007
#define pb push_back
#define big 9223372036854775807
#define big1 LONG_MAX
#define big2 ll_MAX
#define big3 1000000000
#define sma1 LONG_MIN
#define sma2 ll_MIN
#define sma3 -1000000000
#define mp make_pair
#define dub double
#define ivec vector<ll>
#define lvec vector<long long>
#define cvec vector<char>
#define svec vector<string>
#define mt make_tuple
#define MOD 998244353
#define pi acos(-1.0)

#define SZ(x)  (ll)(x.size())
/*
#define ss second.second
#define ff first.first
#define f first
#define s second
#define sf second.first
#define fs first.second*/
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{

    char c;

    cin>>c;

    if(c>='a')
        cout<<"a";
    else
        cout<<'A';


    return 0;
}

Measured memory_bytes: 3612
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long N;
		long[] A = new long[5];
		long[] B = new long[6];
		long[] C = new long[5];
		long[] D = new long[6];
		long[] E = new long[6];
		long[] man = new long[6];
		long ans=0;
		N=sc.nextLong();
		for(int i = 0;i<5;i++) {
			A[i]=sc.nextLong();
		}
		B[0]=-A[0];
		for(int i = 1;i<5;i++) {
			B[i]=A[i-1]-A[i];
		}
		B[5]=A[4];

		long now=A[0];
		long minc=Long.MAX_VALUE;
		for(int i = 0;i<5;i++) {
			C[i]=Math.min(now, A[i]);
			now=C[i];
			minc=Math.min(minc, now);
		}

		for(int i = 1;i<5;i++) {
			B[i]=C[i-1]-C[i];
		}

		long k=N;
		D[0]=N;
		while(D[5]==0) {
			for(int i = 0;i<5;i++) {
				if(D[i]==0) {

				} else if(D[i]>=A[i]) {
					E[i+1]+=A[i];
					D[i]-=A[i];
				} else {
					E[i+1]+=D[i];
					D[i]=0;
				}
			}
			for(int i = 0;i<6;i++) {
				D[i]+=E[i];
				E[i]=0;
			}
			ans++;
		}

		boolean match = true;
		for(int i = 0;i<5;i++) {
			if(C[i]>D[i]) {
				match=false;
				break;
			}
		}
//		System.out.println(match);
		if(match) {
			long plus;
			plus=D[0]/minc;

			for(int i = 0;i<5;i++) {
				D[i]+=B[i]*plus;
			}
//			D[0]%=A[0];
			ans+=plus;
		}

		while(D[0]!=0||D[1]!=0||D[2]!=0||D[3]!=0||D[4]!=0) {
			for(int i = 0;i<5;i++) {
				if(D[i]==0) {

				} else if(D[i]>=A[i]) {
					E[i+1]+=A[i];
					D[i]-=A[i];
				} else {
					E[i+1]+=D[i];
					D[i]=0;
				}
			}
			for(int i = 0;i<6;i++) {
				D[i]+=E[i];
				E[i]=0;
			}
			ans++;
		}

//		for(int i = 0;i<5;i++) {
//			System.out.print(C[i]+", ");
//		}
//		System.out.println();
//		for(int i = 0;i<5;i++) {
//			System.out.print(B[i]+", ");
//		}
//		System.out.println();



		System.out.println(ans);
	}

}


Measured memory_bytes: 23124
#include<cstdio>
#include<cmath>
#include<complex>
#include<string>
#include<map>
using namespace std;
typedef complex<double> xy_t;
xy_t P[110];

int main(){
  int N=0;
  double x,y;
  scanf("%d",&N);
  for(int i=0;i<N;i++){
    scanf("%lf%lf",&x,&y);
    P[i]=xy_t(x,y);
  }
  double sum=0.0;

  for(int i=0;i+2<N;++i){
    xy_t a=P[0],b=P[i+1],c=P[i+2];
    sum+= ((conj(c-a)*(b-a)).imag())/2.0;
  }

  printf("%.1f\n",abs(sum));
  return 0;

}

Measured memory_bytes: 1092
#include <stdio.h>
#include <math.h>
double dis(double x1, double y1, double x2, double y2)
{
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}

int main()
{
    double x1, y1, x2, y2, d;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
    d = dis(x1, y1, x2, y2);

    printf("%.6lf\n", d);

    return 0;
}


Measured memory_bytes: 2044
n = int(input())
s = input()

def calc(st):
    l = 2
    while l<n:
        ed = (l-1)%n
        if (s[ed]=='o' and st[-1]=='S') or (s[ed]=='x' and st[-1]=='W'):
            st += st[-2]
        else:
            if st[-2] == 'S':
                st += 'W'
            else:
                st += 'S'
        l = len(st)
    
    if ((s[-1]=='o' and st[-1]=='S') or (s[-1]=='x' and st[-1]=='W')) and st[-2]!=st[0]:
        return -1
    elif ((s[-1]=='x'and st[-1]=='S')or(s[-1]=='o'and st[-1]=='W'))and st[-2]==st[0]:
        return -1

    if ((s[0]=='o' and st[0]=='S') or (s[0]=='x' and st[0]=='W')) and st[-1]!=st[1]:
        return -1
    elif ((s[0]=='x' and st[0]=='S') or (s[0]=='o' and st[0]=='W'))and st[-1]==st[1]:
        return -1
    return st

for st in ['SS','SW','WS','WW']:
    res = calc(st)
    if res!=-1:
        print(res)
        exit(0)
print(-1)


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

int main(){
  string s;
  int n;
  while(cin>>n,n){
    char c='0';
    int ans=0;
    for(int i=0;i<n;i++){
      cin>>s;
      if(c==s[1])ans++;
      c=s[1];
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  int price,num;
  int n=0;
  int sum=0;
  double ave;

  while(scanf("%d,%d",&price,&num)!=EOF){
    n++;
    sum+=price*num;
    ave+=num;
  }
  ave=ave*1.0/n+0.5;
  cout<<sum<<endl;
  cout<<(int)ave<<endl;
}

Measured memory_bytes: 1208
#include<bits/stdc++.h>
 using namespace std;
 #define rep(i,n) for(int i=0;i<n;++i)
 #define all(v) v.begin(), v.end()
 typedef long long int ll;
 typedef unsigned long long ull;
 template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
 template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
 typedef pair<ll,ll> P;
 const long long MOD = 1e9+7;
 const ll INF = 1LL << 60;

 int main(){
     int a,p;

     cin >> a >> p;

     cout << ((a*3)+p)/2 << endl;


 }


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

const int N=2e5+20,MOD=1e9+7;

int n,zero,p[N];
long long a,b,ans=1;
map <pair <long long,long long>,pair <int,int>> m;

int main()
{
	p[0]=1;
	for(int i=1;i<N;i++) p[i]=(p[i-1]*2)%MOD;

	scanf("%d",&n);
	while(n--)
	{
		scanf("%lld%lld",&a,&b);

		if(a==0 and b==0)
		{
			zero++;
			continue;
		}

		long long g=__gcd(a,b);
		a/=g,b/=g;
		if(b<0) a*=-1,b*=-1;
		if(a<=0) m[{b,-a}].second++;
		else m[{a,b}].first++;
	}

	for(auto i:m)
	{
		auto pr=i.second;
		ans*=(p[pr.first]+p[pr.second]-1ll)%MOD;
		ans%=MOD;
	}

	ans=(ans+zero-1)%MOD;
	if(ans<0) ans+=MOD;
	printf("%lld",ans);
}

Measured memory_bytes: 16988
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, k = [int(x) for x in input().split()]
    ans = 0
    for i in range(1, n + 1):
        x = 1 / n
        score = i
        while score < k:
            score *= 2
            x /= 2
        ans += x
    print(ans)


    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""


"""


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

void selectionSort(int A[], int N, int& cnt) {
  int minj;

  for (int i = 0; i < N; i++) {
    minj = i;
    for (int j = i; j < N; j++) {
      if (A[j] < A[minj]) minj = j;
    }

    if (minj != i) {
      swap(A[i], A[minj]);
      cnt++;
    }

  }
}

int main() {
  int N, j, cnt;
  int A[100];
  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  
  cnt = 0;
  selectionSort(A, N, cnt);

  for (int i = 0; i < N; i++) {
    if ( i != 0 ) cout << " ";
    cout << A[i];
  }
  cout << endl << cnt << endl;

  return 0;
}


Measured memory_bytes: 3096
# coding: utf-8

# https://atcoder.jp/contests/abc110


def main():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    x = sorted(x)
    y = sorted(y)

    x_max = max(x)
    y_min = min(y)

    for z in range(X+1, Y+1):
        if x_max < z <= y_min:
            return "No War"
    
    return "War"


print(main())


Measured memory_bytes: 3060
#include <iostream>
#include <vector>

using namespace std;

int main() {
	int n, m;
	while (cin >> n >> m && (n || m)) {
		vector<int> ta(n), ha(m);
		int sta = 0, sha = 0;
		for (int i = 0; i < n; ++i) {
			cin >> ta[i];
			sta += ta[i];
		}
		for (int i = 0; i < m; ++i) {
			cin >> ha[i];
			sha += ha[i];
		}
		int anst = 105, ansh = 105;
		if ((sta + sha) % 2 == 0) {
			int sa = sta - sha;
			for (int i = 0; i < n; ++i)
				for (int j = 0; j < m; ++j)
					if (ta[i] - ha[j] == sa / 2)
						if (anst + ansh > ta[i] + ha[j]) anst = ta[i], ansh = ha[j];
		}
		if (anst != 105) cout << anst << " " << ansh << endl;
		else cout << -1 << endl;
	}

	return 0;
}


Measured memory_bytes: 3004
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		List<boolean[]> mask = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			mask.add(new boolean[64]);
			int k = sc.nextInt();
			for (int j = 0; j < k; j++) {
				mask.get(i)[sc.nextInt()] = true;
			}
		}
		int q = sc.nextInt();
		boolean[] flags = new boolean[64];
		Arrays.fill(flags, false);
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < q; i++) {
			int op = sc.nextInt();
			int index = sc.nextInt();
			switch (op) {
				case 0:
					if (flags[index]) {
						sb.append(1);
					} else {
						sb.append(0);
					}
					sb.append('\n');
					break;
				case 1:
					for (int j = 0; j < 64; j++) {
						if (mask.get(index)[j]) {
							flags[j] = true;
						}
					}
					break;
				case 2:
					for (int j = 0; j < 64; j++) {
						if (mask.get(index)[j]) {
							flags[j] = false;
						}
					}
					break;
				case 3:
					for (int j = 0; j < 64; j++) {
						if (mask.get(index)[j]) {
							flags[j] = !flags[j];
						}
					}
					break;
				case 4:
					boolean flag = true;
					for (int j = 0; j < 64; j++) {
						if (mask.get(index)[j] && !flags[j]) {
							flag = false;
							break;
						}
					}
					if (flag) {
						sb.append(1);
					} else {
						sb.append(0);
					}
					sb.append('\n');
					break;
				case 5:
					flag = false;
					for (int j = 0; j < 64; j++) {
						if (mask.get(index)[j] && flags[j]) {
							flag = true;
							break;
						}
					}
					if (flag) {
						sb.append(1);
					} else {
						sb.append(0);
					}
					sb.append('\n');
					break;
				case 6:
					flag = true;
					for (int j = 0; j < 64; j++) {
						if (mask.get(index)[j] && flags[j]) {
							flag = false;
							break;
						}
					}
					if (flag) {
						sb.append(1);
					} else {
						sb.append(0);
					}
					sb.append('\n');
					break;
				case 7:
					int count = 0;
					for (int j = 0; j < 64; ++j) {
						if (mask.get(index)[j] && flags[j]) {
							++count;
						}
					}
					sb.append(count);
					sb.append('\n');
					break;
				case 8:
					BigDecimal bd = BigDecimal.valueOf(0L);
					BigDecimal bd2 = BigDecimal.valueOf(1L);
					long tmp = 1L;
					for (int j = 0; j < 64; j++) {
						if (!mask.get(index)[j]) {
							bd2 = bd2.multiply(BigDecimal.valueOf(2L));
							continue;
						}
						if (flags[j]) {
							bd = bd.add(bd2);
						}
						bd2 = bd2.multiply(BigDecimal.valueOf(2L));
					}
					sb.append(bd.toPlainString());
					sb.append('\n');
					break;
			}
		}
		System.out.print(sb.toString());
	}
}



Measured memory_bytes: 111108
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner (System.in);
		int sx = sc.nextInt();
		int sy = sc.nextInt();
		int tx = sc.nextInt();
		int ty = sc.nextInt();
		int dx = tx-sx;
		int dy = ty-sy;
		for(int i=0;i<dy;i++) {
			System.out.print("U");
		}
		for(int i=0;i<dx;i++) {
			System.out.print("R");
		}
		for(int i=0;i<dy;i++) {
			System.out.print("D");
		}
		for(int i=0;i<dx;i++) {
			System.out.print("L");
		}
		System.out.print("L");
		for(int i=0;i<dy+1;i++) {
			System.out.print("U");
		}
		for(int i=0;i<dx+1;i++) {
			System.out.print("R");
		}
		System.out.print("DR");
		for(int i=0;i<dy+1;i++) {
			System.out.print("D");
		}
		for(int i=0;i<dx+1;i++) {
			System.out.print("L");
		}
		System.out.print("U");
	}

}


Measured memory_bytes: 24380
#include<stdio.h>

int main(){
	int x=0,y=0;
	scanf("%d %d",&x,&y);
	while(true){
		int tmp=0;
		tmp=x%y;
		x=y;
		y=tmp;
		if(tmp==0){
			break;
		}
	}
	printf("%d\n",x);
	return 0;
}



Measured memory_bytes: 2688
#include <iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
using namespace std;
typedef long long int ll;
#define EPS 1e-9
#define pb push_back
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
ll vacation(vector<ll>&a,vector<ll>&b,vector<ll>&c,ll n)
{
    vector<vector<ll> >dp(3,vector<ll>(n+1,0));
    FOR(i,1,n+1)
    {
        dp[0][i]=max(dp[1][i-1],dp[2][i-1])+a[i];
        dp[1][i]=max(dp[0][i-1],dp[2][i-1])+b[i];
        dp[2][i]=max(dp[1][i-1],dp[0][i-1])+c[i];
    }
    return max(dp[0][n],max(dp[1][n],dp[2][n]));
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    vector<ll>a(n+1,0);
    vector<ll>b(n+1,0);
    vector<ll>c(n+1,0);
    FOR(i,1,n+1)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    cout<<vacation(a,b,c,n)<<endl;
    return 0;
}

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

using ld=long double;
using P=complex<ld>;

int main(){
    int n;
    cin>>n;
    vector<P> p(n);    
    for(int i=0;i<n;i++){
        ld x,y;
        cin>>x>>y;
        p[i]=P(x,y);
    }
    if(n%2){
        cout<<"NA"<<endl;
        return 0;
    }
    P res=P(0.5,0)*(p[0]+p[n/2]);
    bool isok=true;
    for(int i=0;i<n/2;i++){
        isok&=(abs((p[i]+p[i+n/2])/P(2,0)-res)<1e-7);
    }
    if(isok){
        cout<<setprecision(10)<<fixed;
        cout<<res.real()<<" "<<res.imag()<<endl;
    }
    else{
        cout<<"NA"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3360
#include<iostream>
using namespace std;
int pow(int x,int y){
  int z = 1;
  for(int i=0;i<y;i++) z *= x;
  return z;
}
int main(){
  int n,a,i,ki = 1;cin >> n;
  for(i=0;i<n;i++){
    cin >> a;
    ki *= (a%2==0) + 1;
  }
  cout << pow(3,n)-ki << endl;
}

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

int main()
{
  char s[101];
  int idx, len;
  scanf("%s", s);
  
  len = sizeof(s);
  for(idx=0;s[idx]!=0;idx++)
  {
    s[idx] = 'x';
  }
  
  printf("%s", s);
  return 0;
}


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



typedef long long ll;
#define reg register
#define rep(i,a,b) for(int i=a,i##end=b;i<=i##end;++i)
#define drep(i,a,b) for(int i=a,i##end=b;i>=i##end;--i)


char IO;
inline ll rd(){
	ll s=0,f=0;
	while(!isdigit(IO=getchar())) if(IO=='-') f=1;
	do s=(s<<1)+(s<<3)+(IO^'0');
	while(isdigit(IO=getchar()));
	return f?-s:s;
}


const int N=1010;

int n;
int pre=-1e9;
int main(){
	rep(i,1,n=rd()) {
		int x=rd();
		if(x>=pre+1) x--;
		else if(x<pre) return puts("No"),0;
		pre=x;
	}
	puts("Yes");
}






Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader((new InputStreamReader(System.in)));
        while(true){
            String[] line = reader.readLine().split(" ");
            int w = Integer.parseInt(line[0]), h = Integer.parseInt(line[1]);
            if(w==0 && h==0) break;

            int[][] map = new int[h][w];
            for(int i=0; i<h; i++){
                line = reader.readLine().split(" ");
                for(int j=0; j<w; j++){
                    map[i][j] = Integer.parseInt(line[j]);
                }
            }
            int land = 0;
            for(int i=0; i<h; i++){
                for(int j=0; j<w; j++){
                    if(map[i][j] == 1){
                        removeLand(map, j, i);
                        land++;
                    }
                }
            }
            System.out.println(land);

        }
    }

    public static void removeLand(int[][] map, int x, int y){
        if(y<0 || y>=map.length || x<0 || x>=map[y].length){
            return;
        }
        if(map[y][x] == 1){
            map[y][x] = 0;
            removeLand(map, x-1, y-1);
            removeLand(map, x-1, y);
            removeLand(map, x-1, y+1);
            removeLand(map, x, y+1);
            removeLand(map, x, y-1);
            removeLand(map, x+1, y-1);
            removeLand(map, x+1, y);
            removeLand(map, x+1, y+1);
        }
    }
}

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

using namespace std;

#define REP(i, n) for(int i = 0; i < (n); i++)
#define SORT(v, n) sort(v, v+n);
#define SSORT(v, n) sort(v, v+n, greater<int>())

int main(){
	int n,m;
	cin >> n >> m;
	int k[n],a[n][m],ans[m+1];
	int total = 0;
	REP(i,n){
		cin >> k[i];
		REP(j,k[i]) cin >> a[i][j];
	}
	REP(i,m+1){
		ans[i]=0;
	}
	REP(i,n){
		REP(j,k[i]){
			ans[a[i][j]]++;
		}
	}
	REP(i,m+1){
		if(ans[i]==n) total++;
	}
	cout << total << endl;

}

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

#define fi first
#define se second
#define show(x) cerr << #x << "=" << "\n"
typedef long long ll;
typedef unsigned long long ull;

using namespace std;

string s;
map<pair<string,bool>,bool> mp;

int func(int who, string t) { // return winner
  //cout << "(" << who << "," << t << ")" << endl;
  if (mp.find(make_pair(t, (bool)who)) != mp.end()) return mp[make_pair(t, (bool)who)];
  int n = (int)t.size();
  char pre = t[0];
  for (int i = 1; i < n; i++) {
    if (pre == t[i]) {
      mp[make_pair(t, (bool)who)] = who;
      return who;
    }
    pre = t[i];
  }
  if (n == 2) {
    mp[make_pair(t, (bool)who)] = who - 1;
    return 1 - who;
  }
  if (who == 0) {
    for (int i = 1; i < n - 1; i++) {
      if (func(1, t.substr(0, i) + t.substr(i + 1, n - i - 1)) == 0) {
        mp[make_pair(t, (bool)who)] = 0;
        return 0;
      }
    }
    mp[make_pair(t, (bool)who)] = 1;
    return 1;
  } else {
    for (int i = 1; i < n - 1; i++) {
      if (func(0, t.substr(0, i) + t.substr(i + 1, n - i - 1)) == 1) {
        mp[make_pair(t, (bool)who)] = 1;
        return 1;
      }
    }
    mp[make_pair(t, (bool)who)] = 0;
    return 0;
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(10);
  cout << fixed;
#ifdef LOCAL_DEFINE
  FILE *stream1;
  FILE *stream2;
  stream1 = freopen("in.txt", "r", stdin);
  stream2 = freopen("out.txt", "w", stdout);
  if (stream1 == NULL) return 0;
  if (stream2 == NULL) return 0;
#endif
  cin >> s;
  int n = (int)s.size();
  if (s[0] == s[n - 1]) {
    int tmp = n - 2;
    if (tmp&1) {
      cout << "Second" << endl;
    } else {
      cout << "First" << endl;
    }
  } else {
    int tmp = n - 2;
    if (tmp&1) {
      cout << "First" << endl;
    } else {
      cout << "Second" << endl;
    }
  }
#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s.\n";
  fclose(stream1);
  fclose(stream2);
#endif
  return 0;
}

Measured memory_bytes: 764
class Atcoder
  MAX_N = 9

  def initialize
    _n, m, _r = gets.chomp.split.map(&:to_i)
    r = [0] + gets.chomp.split.map(&:to_i)
    @rsize = r.size
    @dp = Array.new(1 << MAX_N) { Array.new(MAX_N, -1) }

    d = Hash.new { |h, k| h[k] = {} }
    dist = Hash.new { |h, k| h[k] = {} }
    @table = Array.new(@rsize) { Array.new(@rsize, 0) }

    m.times do
      a, b, c = gets.chomp.split.map(&:to_i)
      d[a][b] = c
      d[b][a] = c
    end

    r[1..-1].each do |s|
      queue = []
      queue << [s, 0]
      check_list = Hash.new { |h, k| h[k] = Hash.new(Float::INFINITY) }

      until queue.empty?
        node = queue.shift
        next if check_list[s][node.first] <= node.last
        check_list[s][node.first] = node.last

        dist[s][node.first] = node.last
        dist[node.first][s] = node.last

        d[node.first].each_key do |n|
          queue << [n, node.last + d[node.first][n]]
        end
      end
    end

    r.each_with_index do |a, i|
      r.each_with_index do |b, j|
        next if i == j
        if i == 0 || j == 0
          @table[i][j] = 0
        else
          @table[i][j] = dist[a][b]
        end
      end
    end

    puts r[1..-1].permutation.map { |list|
      cost = 0

      list.each_cons(2) do |a, b|
        cost += dist[a][b]
      end

      cost
    }.min

    #puts rec(0, 0)
  end

  def rec(s, v)
    if @dp[s][v] >= 0
      return @dp[s][v]
    end

    if s == (1 << @rsize) - 1 && v == 0
      return @dp[s][v] = 0
    end

    res = Float::INFINITY

    @rsize.times do |u|
      if (s >> u & 1) == 0
        val = rec(s | 1 << u, u)

        res = [res, val + @table[v][u]].min
      end
    end

    @dp[s][v] = res
  end
end

Atcoder.new


Measured memory_bytes: 30184
import sys

input = sys.stdin.readline


def main():
    N = int(input())
    A = input().rstrip()
    B = input().rstrip()
    C = input().rstrip()

    ans = 0
    for a, b, c in zip(A, B, C):
        if a == b == c:
            pass
        elif a == b or b == c or c == a:
            ans += 1
        else:
            ans += 2

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<utility>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(int i=0;i<(int)n;i++)

int main(void) {
	int a=0;
	string str, xx; cin >> str >> xx;
	rep(i, 3)if (str[i] == xx[i])a++;
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int s = (a + b) * h / 2;
        System.out.println(s);
    }
}

Measured memory_bytes: 21844
#if 1
#pragma GCC optimize "O3"
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <fstream>
#include <iostream>
#include <sstream>
#include <random>
#include <cassert>
#include <cmath>
#include <cstring>
#include <chrono>
using namespace std;
using i8 = int8_t; using i16 = int16_t; using i32 = int32_t; using i64 = int64_t; using u8 = uint8_t; using u16 = uint16_t; using u32 = uint32_t; using u64 = uint64_t; using f32 = float; using f64 = double;
template <class T> inline T sq(T a) { return a * a; }
template <class T> inline bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } return false; }
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
void _u() { cerr << endl; } template <class H, class... T> void _u(H&& h, T&&... t) { cerr << h << ", "; _u(move(t)...); }
#define _polyfill(v) v
#define _overload3(a, b, c, d, ...) d
#define _rep3(i, a, b) for (i32 i = i32(a); i < i32(b); ++i)
#define _rep2(i, b) _rep3(i, 0, b)
#define _rep1(i) for (i32 i = 0; ; ++i)
#define rep(...) _polyfill(_overload3(__VA_ARGS__, _rep3, _rep2, _rep1)(__VA_ARGS__))
#define A(a) begin(a), end(a)
#define S(a) i32((a).size())
#define U(...) { cerr << #__VA_ARGS__ << ": "; _u(__VA_ARGS__); }
#define lin U(__LINE__)
#define exi exit(0);
#endif

class timer {
    vector<timer> timers;
    int n = 0;
public:
    double limit = 2.95;
    double t = 0;
    timer() {}
    timer(int size) : timers(size) {}
    bool elapses() const {
        return time() - t > limit;
    }
    void measure() {
        t = time() - t;
        ++n;
    }
    void measure(char id) {
        timers[id].measure();
    }
    void print() {
        if (n % 2)
            measure();
        for (int i = 0; i < 128; ++i) {
            if (timers[i].n)
                cerr << (char)i << ' ' << timers[i].t << 's' << endl;
        }
        cerr << "  " << t << 's' << endl;
    }
    static double time() {
#ifdef LOCAL
        return __rdtsc() / 3.3e9;
#else
        using namespace std::chrono;
        return duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count() / 1000.0;
#endif
    }
} timer(128);

constexpr bool Deterministic = 0;
class rando {
    unsigned y;
public:
    rando(unsigned y) : y(y) {}
    unsigned next() {
        return y ^= (y ^= (y ^= y << 13) >> 17) << 5;
    }
    int next(int b) {
        return next() % b;
    }
    int next(int a, int b) {
        return next(b - a) + a;
    }
    double nextDouble(double b = 1) {
        return b * next() / 4294967296.0;
    }
    double nextDouble(double a, double b) {
        return nextDouble(b - a) + a;
    }
    int operator() (int b) {
        return next(b);
    }
} rando(Deterministic ? 2463534242 : random_device()());

i32 main() {
    i32 N, K;
    string s;
    cin >> N >> K >> s;
    s[K - 1] = s[K - 1] - 'A' + 'a';
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define N 500001

int A[N],H;

void maxHeapify(i){
  int r,l,largest,tmp;
  l = i*2+1;
  r = i*2+2;
  if(l <= H && A[l] > A[i]) largest = l;
  else largest = i;
  if(r <= H && A[r] > A[largest]) largest = r;
  if(largest != i){
    tmp = A[i];
    A[i] = A[largest];
    A[largest] = tmp;
    maxHeapify(largest);
  }
}
void buildMaxHeap(){
  int i;
  for(i=H/2; i>=0; i--){
    maxHeapify(i);
  }
}
int main(){
  int i;
	scanf("%d",&H);
	for(i=0; i<H; i++){
		scanf("%d",&A[i]);
	}
  buildMaxHeap();
  for(i=0; i<H; i++) printf(" %d",A[i]);
  printf("\n");
  return 0;
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
int n;
int k;
int a[60];
int ans=0;

int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int i=0;i<k;i++){
		ans+=a[n-1-i];
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
//
//  main.cpp
//  HelloWorld
//
//  Created by purple on 2020/04/13.
//  Copyright © 2020 Purple. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>

using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...
 

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

    cout << "-1 -1 -1" << endl;
    
    return 0;
    
}


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

int main()
{
	int ans;
	ans = 0;
	//int a[10];
	string s;
	cin >>s;

	if (s[0] == '1') {
		ans = ans + 1;
	}
	if (s[1] == '1') {
		ans = ans + 1;
	}
	if (s[2] == '1') {
		ans = ans + 1;
	}

	cout << ans << endl;


	return 0 ;

}

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

int main(void){
	int a,b,n,x,i,ok;

	for(scanf("%d",&n);n>0;n--){
		ok=1;a=0;b=0;
		for(i=0;i<10;i++){
			scanf("%d",&x);
			if(ok==1){
				if(x>a)a=x;
				else if(x>b){
					if(b>a){
						b=a;
						a=x;
					}else b=x;
				}
				else ok=0;
			}
		}
		printf("%s\n",ok==1 ? "YES":"NO");
	}

	return 0;
}

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

const int N = 1e5 + 10;
set<pair<int,int> > st;
int n, x[N], mx;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> x[i];
		mx = max(mx, x[i]);
	}
	for (int i = 0; i < n; i++)
		if(x[i] != mx)
			st.insert({abs(mx / 2 - x[i]), i});
		
	cout << mx << ' ' << x[(*st.begin()).second];
}


Measured memory_bytes: 5376
n = gets.to_i
xy = n.times.map{gets.split.map(&:to_i)}

sum = 0
xy.permutation(n){|z|
  cost = 0
  (n-1).times.map{|i|
    xd = (z[i][0] - z[i+1][0])**2
    yd = (z[i][1] - z[i+1][1])**2
    cost += Math.sqrt(xd+yd)
  }
  sum += cost
}

p sum/((1..n).map.inject(:*))


Measured memory_bytes: 4220
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<climits>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define mkp make_pair
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;
/*
ll bin(ll i,ll j){
	ll mid=(i+j)/2;
	if(a[mid]==x)reutrn mid;
	else if(ans>x)return bin(i,mid-1);
	else return bin(mid+1,j);
}/*
ll power(ll base,ll power){
    ll res=1;
    base=base%mod;
    while(power>0){
    	if(power&1){
    		res=(res*base)%mod;
		}
		power=power>>1;
		base=(base*base)%mod;
	}
	return res;
}
*/
/*
int nCr(int x, int y){
	if(y>x)return 0;
	int num=fact[x];
	num*=invfact[y];
	num%=mod;
	num*=invfact[x-y];
	num%=mod;
	return num;
}
*/
/*bool prime[n+1];
void SieveOfEratosthenes(int n){
	rep(i,0,n+1)prime[i]=true
    for (int p=2;p*p<=n;p++)
        if (prime[p])
            for (int i=p*p;i<=n;i+=p)prime[i]=false;
}*/
/*
int gcd(int a,int b){
	if(b==0)return a;
	else return gcd(b,a%b);
}
*/
int solve(){
    ll r,d,x;
    cin>>r>>d>>x;    
	rep(i,0,10){
		ll val=r*x-d;
		x=val;
		cout<<val<<endl;
	}
	return 0;
}
int main(){
    waste;
    int t;
    //cin>>t;
    t=1;
    while(t--){
       	solve();
    }
}


Measured memory_bytes: 3576
while True:
    a,b = map(int, input().split())

    if a == 0 and b == 0: break

    for i in range(a):
        for j in range(b):
            if i==0 or i==a-1 or j==0 or j==b-1:
                print("#", end="")
            else:
                print(".", end="")
        print()
    print()


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

using namespace std;
using ll = long long;

class UnionFind{
  private:
    vector<int> data; //data[i] : 頂点i
  public:

    UnionFind(int n) : data(n,-1) {}
    int root(int i) { return data[i] < 0 ? i : data[i] = root(data[i]); }
    int size(int i) { return -data[root(i)]; }
    bool same(int x, int y) {return root(x) == root(y); }
    bool connected() {return size(0) == (int)data.size(); }
    

    bool unit(int i,int j){
        i = root(i);
        j = root(j);
        if(i != j){
            if(data[j] < data[i])swap(i, j);
            data[i] += data[j];
            data[j] = i;
        }
        return i != j;
    }

};

int main()
{
    int n, m; cin >> n >> m;
    UnionFind tree(n);
    for(int i = 0; i < m; i++) {
        int x, y, z; cin >> x >> y >> z;
        tree.unit(x - 1, y - 1);
    }
    set<int> st;
    for(int i = 0; i < n; i++)st.insert(tree.root(i));
    cout << st.size() << endl;
}

Measured memory_bytes: 8252
#include<bits/stdc++.h>
using namespace std;
const int nax=1e5+5;
vector<int> edges[nax];
int depth[nax];
int in_degree[nax];
vector<bool> visited(nax,false);
void dfs(int u){
    visited[u]=true;
     for(auto v:edges[u]){
        depth[v]=max(depth[v],depth[u]+1);
        in_degree[v]--;
        if(in_degree[v]==0)
            dfs(v);
     }
}
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        edges[u].push_back(v);
        in_degree[v]++;
    }
     for(int i=1;i<=n;i++){
        if(!visited[i] && in_degree[i]==0) dfs(i);
     }
     int ans=0;
     for(int i=1;i<=n;i++){
        ans=max(ans,depth[i]);
     }
     cout<<ans;

}


Measured memory_bytes: 14420
#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
using namespace std;
 
#define int long long
#define INF (1e18)+1
 
int nChoosek( int n, int k )
{
    if (k > n) return 0;
    if (k * 2 > n) k = n-k;
    if (k == 0) return 1;

    int result = n;
    for( int i = 2; i <= k; ++i ) {
        result *= (n-i+1);
        result /= i; 
    }
    return result;
}

int choose2(int n){
	
	return n*(n-1)/2;
}

int arr[200001];

int32_t main() {
 
  	int N,K;
  	
  	cin >> N >> K;
  	
  	for(int i=0; i<N; i++){
  	 
  		cin >> arr[i];  	
  		
	}
	
	sort(arr,arr+N);
	
	int l = -INF , r = INF;
	
	while(l+1 < r){
		
		int x = (l+r)/2;
		int cnt = 0;
		for(int i=0; i<N; i++){
			
			if(arr[i] < 0){
				
				int left = i;
				int right =  N;
				
				while(left+1 < right){
					
					int m = (left+right)/2;
					
					if(arr[m] * arr[i]  < x ){
						right = m;
					}
					else{
						left = m;
					}
				}
				cnt += N - right;
			}
			else{
				
				int left = i;
				int right = N;
				
				while(left+1 < right){
					
					int m = (left+right)/2;
					
					if(arr[m] * arr[i] < x)
						left = m;
					else
						right =m;
					
				}
				
				cnt+= left-i;
				
				
			}
			
		//	if(arr[i] * arr[i] < x){
		//		cnt--;
		//	}
			
			
		}
		
		//cnt /= 2;
		
		if(cnt < K){
			l = x;
		}
		else{
			r = x;
		}
		
	}
	
	
	cout << l << endl;
	
	
 
}

Measured memory_bytes: 4720
#include<iostream>
#include<algorithm>
#include<vector>

int main() {
	int N;
	int temp = 0;
	std::vector<int> D;

	std::cin >> N;

	for (int i = 0; i < N; i++) {
		std::cin >> temp;
		D.emplace_back(temp);
	}

	std::sort(D.begin(), D.end());

	int answer = 0;
	temp = 0;

	for (std::vector<int>::size_type i = 0; i < D.size(); i++)
		if (i > 0) {
			if (D[i - 1] != D[i])
				answer++;
		}
		else
			answer++;

	std::cout << answer << std::endl;

	return 0;
}

Measured memory_bytes: 256
"use strict";

function Main(input) {
    input=input.split(" ");
    var W=parseInt(input[0],10);
    var H=parseInt(input[1],10);
    var x=parseInt(input[2],10);
    var y=parseInt(input[3],10);
    var r=parseInt(input[4],10);
    if(x >= r && x <= W-r && y >= r && y <= H-r)
        console.log("Yes");
    else
        console.log("No");
}
    

function debug(){
	var input = document.getElementById("input").value;
	Main(input);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 15556