akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int H; cin >> H;
    int n = 0, h = H;
    while(h > 0){
        n++;
        h /= 2;
    }
    int ans = 0, k = 1;
    REP(i, n){
        ans += k;
        k *= 2;
    }
    Out(ans);

    return 0;
}


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

int main() {

  int N , D , X;

  cin >> N >> D >> X;

  vector<int> vec(N);

  for (int i = 0 ; i < N ; i++){

    cin >> vec[i]  ;

  }

  vector<int> ko(N) ;

  for ( int i = 0 ; i < N ; i++){

    for( int k = 0 ; k < D ; k++){
      
       

      if ( D == vec[i] * k + 1){

        ko[i] = k + 1;

        break;

      }

      else if( D < vec[i] * k + 1) {

         ko[i] = k  ;

         break ;

       }

    }

  }


  int sum = 0;

  for ( int i = 0 ; i < N ; i++){

    sum += ko[i] ;

  }


  cout << sum + X << endl ;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>


using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }


constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll D, T, S; cin >> D >> T >> S;
	if (S * T >= D) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

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

int main() {
  string a;
  cin >> a;
  for(int i = 0; i < 5; i++) {
    cout << a[i];
  }
  cout << " ";
  for(int i = 6; i < 13; i++) {
    cout << a[i];
  }
  cout << " ";
  for(int i = 14; i < 19; i++) {
    cout << a[i];
  }

}


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

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;

template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


struct Mo{
    int l, r;
    function<void(int)> left_add, left_erase, right_add, right_erase;
    Mo(function<void(int)> left_add, function<void(int)> left_erase,
       function<void(int)> right_add, function<void(int)> right_erase,
       int sl = 0, int sr = 0) :
       l(sl), r(sr), left_add(left_add), left_erase(left_erase), right_add(right_add), right_erase(right_erase){}
    void move(int next_l, int next_r){
        for(int i = l; i < next_l; ++i)
            left_erase(i);
        for(int i = l - 1; i >= next_l; --i)
            left_add(i);
        for(int i = r; i < next_r; ++i)
            right_add(i);
        for(int i = r - 1; i >= next_r; --i)
            right_erase(i);
        l = next_l, r = next_r;
    }
};

template <typename ResultType>
vector<ResultType> mo_query(Mo& mo, vector<pair<int,int>>& queries, function<ResultType(int)> get_func, int packet=512){
    int q = queries.size();
    vector<tuple<int,int,int>> sort_queries;
    for(int i = 0; i < q; ++i)
        sort_queries.emplace_back(queries[i].first / packet, queries[i].second, i);
    sort(sort_queries.begin(), sort_queries.end());
    vector<ResultType> ans(q);
    for(auto& query : sort_queries){
        int idx = get<2>(query);
        mo.move(queries[idx].first, queries[idx].second);
        ans[idx] = get_func(idx);
    }
    return ans;
}


signed main(){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(k), b(k);
    for(int i = 0; i < k; ++i){
        cin >> a[i] >> b[i];
        --a[i], --b[i];
    }

    vector<pair<int,int>> queries;
    vector<int> type(q), s(q), t(q), x(q);
    for(int i = 0; i < q; ++i){
        cin >> type[i] >> s[i] >> t[i] >> x[i];
        --s[i], --x[i];
        queries.emplace_back(s[i], t[i]);
    }

    vector<int> data(n), idxes(n);
    iota(data.begin(), data.end(), 0);
    iota(idxes.begin(), idxes.end(), 0);
    auto right_f = [&](int idx){
        if(idx >= k)
            return;
        swap(data[a[idx]], data[b[idx]]);
        idxes[data[a[idx]]] = a[idx];
        idxes[data[b[idx]]] = b[idx];
    };
    auto left_f = [&](int idx){
        if(idx >= k)
            return;
        swap(data[idxes[a[idx]]], data[idxes[b[idx]]]);
        int idx_1 = idxes[a[idx]];
        int data_idx_1 = data[idx_1];
        int idx_2 = idxes[b[idx]];
        int data_idx_2 = data[idx_2];
        idxes[data_idx_1] = idx_1;
        idxes[data_idx_2] = idx_2;
    };
    Mo mo(left_f, left_f, right_f, right_f);
    auto ans = mo_query<int>(mo, queries, [&](int idx){return type[idx] == 1 ? data[x[idx]] : idxes[x[idx]];});

    for(int i = 0; i < q; ++i)
        cout << ans[i] + 1 << endl;

    return 0;
}


Measured memory_bytes: 9140
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

#define int long long
#define MOD 1000000007

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()
#define mp(a, b) make_pair((a), (b))

using namespace std;

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

struct Node {
	bool visited = false;
	vector<int> nexts;
};

vector<Node> nodes;

void dfs(int now, deque<int> &ret, bool front) {
	nodes[now].visited = true;

	if (front) ret.push_front(now);
	else ret.push_back(now);

	for (int next : nodes[now].nexts) {
		if (nodes[next].visited) continue;
		dfs(next, ret, front);
		break;
	}
}

signed main() {
	int N, M;
	cin >> N >> M;

	nodes.resize(N);

	rep(i, M) {
		int A, B;
		cin >> A >> B;
		A--; B--;
		nodes[A].nexts.push_back(B);
		nodes[B].nexts.push_back(A);
	}

	deque<int> ret;
	dfs(0, ret, true);
	ret.pop_back();
	dfs(0, ret, false);

	cout << ret.size() << endl;
	for (int num : ret) cout << num + 1 << " ";
	cout << endl;
}


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

#include <iomanip>
using pii = pair<int, int>;
int main() {
    cout << fixed << setprecision(12);
    int N, W; cin >> N >> W;
    vector<pair<int, int>> items(N);
    for (auto &p: items) cin >> p.first >> p.second;    // v, w
    sort(items.begin(), items.end(), [](pii a, pii b) {
        return 1LL * a.first * b.second > 1LL * b.first * a.second;
    });
    double ans = 0;
    for (auto p: items) {
        int w = min(W, p.second);
        ans += 1.0 * p.first * w / p.second;
        W -= w;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3608
import sys
sa=list(input())
sb=list(input())
sc=list(input())

hito=["A","B","C"]
cardlist=[sa,sb,sc]

turn=0

while True:
	if len(cardlist[turn]) == 0:
		print(hito[turn])
		sys.exit()
	
	next = cardlist[turn].pop(0)
	if next == "a" :
		turn=0
	if next == "b" :
		turn=1
	if next == "c" :
		turn=2


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

int main() {
int A, B, C, D;
cin >> A >> B >> C >> D;
  
  if ( A + B == C + D ) {
    cout << "Balanced" << endl;
  }
  if ( A + B > C + D ) {
    cout << "Left" << endl;
  }
  if ( A + B < C + D ) {
    cout << "Right" << endl;
  }
}  

Measured memory_bytes: 256
import java.io.*;
import java.util.*;

/**
 * Created by Ayushi on 16 Feb 2020.
 * Problem:
 * Round:
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String temp = br.readLine();
        int n = Integer.parseInt(temp);
        String[] ans = new String[n];
        int a = 0;
        int m = 1;
        HashMap<String, Integer> hmap = new HashMap<>();
        hmap.put("", 0);
        for (int i = 0; i < n; i++) {
            temp = br.readLine();

            if (hmap.containsKey(temp)) {
                hmap.replace(temp, hmap.get(temp)+1);
                m = Math.max(m, hmap.get(temp));
                ans[i] = "";
            }
            else {
                hmap.put(temp, 1);
                ans[i] = temp;
                a++;
            }
        }
        br.close();

        Arrays.sort(ans);
        for (int j = n-a; j < n; j++) {
            if (hmap.get(ans[j]) != m) {
                ans[j] = "";
            }
        }
        Arrays.sort(ans);
        for (int k = 0; k < n; k++) {
            if (!(ans[k].equals(""))) System.out.println(ans[k]);
        }
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------



int N,M;
vector<int> ev[602020];
int did[602020];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	int ret=0;
	cin>>N>>M;
	FOR(i,N) {
		cin>>x>>y;
		x+=M-1;
		y--;
		ev[y].push_back(x);
		ev[y+M].push_back(x+M);
	}
	
	multiset<int> ed;
	int ma=0;
	FOR(i,3*M) {
		FORR(e,ev[i]) ed.insert(e);
		while(ed.size() && *ed.begin()<i) ed.erase(ed.begin());
		
		if(i) did[i]=did[i-1];
		if(ed.size()) {
			did[i]++;
			ed.erase(ed.begin());
		}
		if(i>M) ma=max(ma,did[i]-did[i-M]);
	}
	
	cout<<N-ma<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 31084
// питер паркер эй! люблю мэри джэйн)
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ld;
#define rapgame ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define eb emplace_back
#define vi vector <int>
#define vlli vector <lli>
#define vulli vector <ulli>
#define vchar vector <char>
#define vstr vector <string>
#define vb vector <bool>
#define fst first
#define sec second
#define srt(a) sort(a.begin(),a.end())
#define vpii vector <pair <int,int> >
#define pii pair <int,int> 
#define vplli vector <pair <lli,lli> >
#define vpulli vector <pair <ulli,ulli> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pair <int,int>> >
#define vvb vector <vector <bool> >
#define fr(i,n) for (int i = 0; i < (n); i++)
#define frbig(i,n) for (lli i = 0; i < (n); i++)
#define fra(i,a,n) for (lli i = a; i < (n); i++)
#define run(c,s) for(auto c:s) 
#define read(n) int n; cin >> n;
#define read2(x,y) int x,y; cin >> x >> y;
#define read2ll(x,y) long long int x,y; cin >> x >> y;
#define readll(n) lli n; cin >> n;
#define watch(x) cout << (#x) << " is " << (x) << endl
#define print_array(x) fr(i,x.size()) cout << x[i] << " ";
using namespace std;
const lli MOD = 1e9 + 7;
int ans=0;
void lol(lli &n){
    bool rap=0;
    for(lli i=2;i*i<=n;++i){
        if(n%i==0){
            rap=1;
            int k=0,a=1;
            while(n%i==0){
                k++;
                n/=i;
            }
            while(k>=a){
                ans++;
                k-=a;
                a++;
            }
            break;
        }
    }
    if(!rap){
        ans++;
        n=1;
    }
}
int main(){
    rapgame
    readll(n);
    while(n!=1){
        lol(n);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3644
import java.util.*;
public class Main {
	static long dist[][];
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int a[] = new int[M];
		int b[] = new int[M];
		int c[] = new int[M];
		
		dist = new long[N][N];
		for(int i = 0; i < N; i++) {
			Arrays.fill(dist[i], Integer.MAX_VALUE);
		}
		
		for(int i = 0; i < M; i++) {
			a[i] = sc.nextInt() - 1;
			b[i] = sc.nextInt() - 1;
			c[i] = sc.nextInt();
			dist[a[i]][b[i]] = c[i];
			dist[b[i]][a[i]] = c[i];
		}
		
		WarshallFloyd(N);
		int ans = M;
		for(int i = 0; i < M; i++) {
			boolean shortest = false;
			for(int j = 0; j < N; j++) {
				for(int k = 0; k < N; k++) {
					if(j == k) continue;
					if(dist[j][a[i]] + c[i] + dist[k][b[i]] == dist[j][k]) {
						shortest = true;
					}
				}
			}
			if(shortest) ans--;
		}
		
		System.out.println(ans);
	}
	
	static void WarshallFloyd(int N) {
		for(int k = 0; k < N; k++) {
			for(int i = 0; i < N; i++) {
				for(int j = 0; j < N; j++) {
					if(i == j) {
						dist[i][j] = 0;
					} else {
						dist[i][j] = Math.min(dist[i][j], dist[i][k] + dist[k][j]);
					}
				}
			}
		}
	}
}


Measured memory_bytes: 26248
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static void Main()
	{
		var lengths = Array.ConvertAll(Console.ReadLine().Split(new[] { ' ' }), number => int.Parse(number));

		Console.WriteLine(lengths[1] * lengths[0] / 2);

		//デバッグ実行での確認用。そのまま提出しても問題なし
		Console.ReadKey();
	}
}


Measured memory_bytes: 11092
#include <stdio.h>

int main() {
	int ans = -1, i, i100, i10, i1, j, m, n, flag = 0, s[5], c[5];
	scanf("%d %d", &n, &m);
	for (i = 0; i < m; i++) {
		scanf("%d %d", &s[i], &c[i]);
	}
	if (n == 1) {
		for (i = 0; i < m; i++) {
			if (c[i] != 0){flag = 1; break;}
		}
		if (flag == 0) {
			printf("0"); return 0;
		}
		flag = 0;
		for (i = 1; i <= 9; i++) {
			for (j = 0; j < m; j++) {
				if (s[j] == 1 && c[j] != i)flag = 1;
			}
			if (flag == 0) {
				ans = i;
				break;
			}
			flag = 0;
		}
	}
	else if (n == 2) {
		flag = 0;
		for (i = 10; i <= 99; i++) {
			i10 = i / 10;
			i1 = i % 10;
			for (j = 0; j < m; j++) {
				if (s[j] == 1 && c[j] != i10)flag = 1;
				if (s[j] == 2 && c[j] != i1)flag = 1;
			}
			if (flag == 0) {
				ans = i;
				break;
			}
			flag = 0;
		}
	}
	else {
		flag = 0;
		for (i = 100; i <= 999; i++) {
			i100 = i / 100;
			i10 = (i - i100 * 100) / 10;
			i1 = i % 10;
			for (j = 0; j < m; j++) {
				if (s[j] == 1 && c[j] != i100)flag = 1;
				if (s[j] == 2 && c[j] != i10)flag = 1;
				if (s[j] == 3 && c[j] != i1)flag = 1;
			}
			if (flag == 0) {
				ans = i;
				break;
			}
			flag = 0;
		}
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 128
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef 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 per(i,a,b) for(int i=(b)-1;i>=(a);--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
// }}}

int main(){
  int A , B , C , D;
  cin >> A >> B >> C >> D;
  A = abs(A - C);
  B = abs(B - D);
  cout << A + B - __gcd(A , B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, a, b) for (int i = (a); i < (b); i++)
//#include "library/debug.cpp"

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

    string s;
    cin >> s;
    int n = s.size();
    int l = (n - 1) / 2, r = n / 2;
    int k = n / 2;
    if (s[l] == s[r]) {
        char c = s[l];
        while (s[l] == c && s[r] == c) {
            k++;
            if (k == n) break;
            l--;
            r++;
        }
    }
    cout << k << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.Scanner; // ?????¨?????????????????????

public class Main {
    public static void main(String[] args) {
        // ?????????????????\?????????????????¨?????? sc ??????????????? (???????????????????????????????????????????????°???????????????).
        Scanner sc = new Scanner(System.in);

        // ????????? sc ??? int ?????¨?????? 1 ?????\???????????????.
        int W = sc.nextInt();
        int H = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int r = sc.nextInt();

        // ??????????????¢??????????????????????????????.
        if (x - r >= 0 && x + r <=  W && y - r >= 0 && y + r <= H) { System.out.println("Yes"); }
        else { System.out.println("No"); }
    }
}

Measured memory_bytes: 26292
N, K = map(int, input().split())
# R, S, P = map(int, input().split())
B = list(map(int, input().split()))

T = list(map(lambda c: 0 if c == 'r' else 1 if c == 's' else 2, list(input())))




#dp[i][c] : i回目にcを出す時のその時点でのi(modK)回目の類の得点の最大値
dp = [[0 for c in range(3)] for i in range(N + 1)]

for i in range(1,N+1):
    for c in range(3):
        bonus = B[c] if (T[i - 1] - c) % 3 == 1 else 0

        if i <= K:
            dp[i][c] = bonus
        else:
            dp[i][c] = bonus + max(dp[i - K][(c + 1) % 3], dp[i - K][(c + 2) % 3])

print(sum([max(dp[i]) for i in range(N - K + 1, N + 1)]))
# print(dp[N - K + 1 : N + 1])



# print(dp)

Measured memory_bytes: 25320
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    char[] ch=sc.next().toCharArray();
    int[] nums=new int[4];
    for(int i=0;i<ch.length;i++){
      switch(ch[i]){
        case 'N':
          nums[0]++;
          break;
        case 'W':
          nums[1]++;
          break;
        case 'S':
          nums[2]++;
          break;
        case 'E':
          nums[3]++;
          break;
      }
    }
    if(((nums[0]>0&&nums[2]>0)||(nums[0]==0&&nums[2]==0))&&((nums[1]>0&&nums[3]>0)||(nums[1]==0&&nums[3]==0))){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
  }
}


Measured memory_bytes: 21844
n = int(input())
array = []

for i in range(n):
    array.append(int(input()))

m = max(array)
c = array.count(m)
sa = array[:]
sa.remove(m)
m2 = max(sa)

for e in array:

    if e != m:
        print(m)
    else:
        if 1 < c:
            print(m)
        else:
            print(m2)


Measured memory_bytes: 14076
#include<cstdio>
#include<bits/stdc++.h>
typedef long long int ll;
#define REP(i, n) for(int i = 0; i < (n); i++)
#define FOR_IN(i, a, b) for(int i = (a); i < (b); i++)
#define BETWEEN(x, a, b) ((x) >= (a) && (x) <= (b))
#define BIT(b, i) (((b) >> (i)) & 1)
#define LOG_F 1
#define LOG(...) if(LOG_F) fprintf(stderr, __VA_ARGS__)

using namespace std;

ll pow(int x, int n){
  return n == 0 ? 1 : x * pow(x, n - 1);
}


/*
h w
sij

h,w 50
 */
int h,w;
char s[50][50];
int di[]={0,1,0,-1};
int dj[]={1,0,-1,0};

int main(){
  cin>>h>>w;
  REP(i,h){
    REP(j,w){
      cin>>s[i][j];
    }
  }

  REP(i,h){
    REP(j,w){
      if(s[i][j] == '.') continue;

      bool f=false;

      REP(k,4){
        f = f || s[i+di[k]][j+dj[k]] == '#';        
      }

      if(!f){
        cout<<"No\n";
        return 0;
      }
    }
  }

  cout<<"Yes\n";

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
typedef long long ll;
int main (void) {
    ll Q;
    ll H;
    ll S;
    ll D;
    ll N;

    cin >> Q >> H >> S >> D;
    cin >> N;

    ll mi2 = min(min(min(8 * Q, 4 * H), 2 * S), D);
    ll mi1 = min(min(4 * Q, 2 * H), S);
    ll ans = (N / 2) * mi2 + (N % 2) * mi1;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
use std::io::stdin;
use std::str::FromStr;

fn read_line<T>() -> Vec<T>
where
    T: FromStr,
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let mut s = String::new();
    stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect()
}

fn main() {
    let in_vec: Vec<usize> = read_line();
    let n = in_vec[0];
    let k = in_vec[1];

    let mut res: usize = 0;
    for i in k..=n+1 {
        res = (res + (n + 1 - i) * i + 1) % 1_000_000_007;
    }

    println!("{}", res);
}


Measured memory_bytes: 2120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

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

	printf("%d", n * n * n);

	return 0;
}

Measured memory_bytes: 256
h, w, k = gets.split.map(&:to_i)
squares = Array.new

ans = 0

h.times do
  line = gets.chomp.chars
  squares << line
end

tmp = Marshal.dump(squares)

[0, 1].repeated_permutation(h).each do |x|
  [0, 1].repeated_permutation(w).each do |y|
    copy = Marshal.load(tmp)
    x.each.with_index do |xi, i|
      y.each.with_index do |yj, j|
        copy[i].fill("?") if xi == 1
        copy[i][j] = "?" if yj == 1
      end
    end
    ans += 1 if copy.flatten.count("#") == k
  end
end

puts ans


Measured memory_bytes: 14412
import java.util.*;


public class Main {
    public static void main(String[] args) {
      
      Scanner sc = new Scanner(System.in);
      int n = Integer.parseInt(sc.next());
      if (n < 100) {
      	if (n >= 10) {
          System.out.print(9);
        } else {
        	System.out.print(n);
        }
      } else if (n < 10000) {
        if (n >= 1000) {
          System.out.print(909);
        } else {
        	n -= 90;
        	System.out.print(n);
        }
      } else {
        if (n >= 100000) {
          System.out.print(90909);
        } else {
        	n -= 9090;
        	System.out.print(n);
        }
      }
      
    }
}

Measured memory_bytes: 21716
A, V = map(int,input().split())
B, W = map(int,input().split())
T = int(input())
sa = W-V
if sa == 0:
    if A != B:
        print('NO')
    else:
        print('YES')
    exit()
if W>V:
    print('NO')
    exit()
if (abs(B-A)/(V-W)) <= T:
    print('YES')
else:
    print('NO')

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

long long int twins(long long int a){
    // n>=2のときnC2, n=1,0のとき0を返す関数
    if(a<=1){
        return 0;
    }
    else{
        return (a*(a-1)/2);
    }
}
 
int main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    vector<int> kosu(N);
    for(int i=0; i<N; i++){
        cin >> vec.at(i);
        kosu[vec.at(i)-1]++;
    }
    long long int tot =0;
    for(int i=0; i<N; i++){
        tot += twins(kosu[i]);
    }

    vector<long long int> kumi(N);
    for(int i=0; i<N; i++){
        kumi.at(i)= tot - twins(kosu[vec[i]-1]) + twins(kosu[vec[i]-1]-1); 
        cout << kumi.at(i) << endl;
    }


}

Measured memory_bytes: 5760
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
#include<list>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  cout << max(c-(a-b),0) << endl;
  return 0;
}

Measured memory_bytes: 3596
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <stdio.h>
#include <math.h>
#include <utility>
#include <algorithm>

using namespace std;

int main() {
	int n,k;
	string s;
	cin >> n>>k;
	cin >> s;
	s[k - 1] += 0x20;;

	cout << s;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

void swap(int& x, int& y)
{
	int t = x;
	x = y;
	y = t;
}

int f(int x, int y)
{
	if(x == 1 && y == 2) return 3;
	else if(x == 1 && y == 3) return 2;
	else if(x == 2 && y == 3) return 1;
}

int main()
{
	int x, y;
	scanf("%d%d", &x, &y);
	if(x > y) swap(x, y);
	printf("%d\n", f(x, y));
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, r; cin >> n >> r;
	if(n >= 10) cout << r << '\n';
	else cout << r + 100 * (10 - n) << '\n';
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << endl
#define debugArray(x, n)                           \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
  cerr << #x << "[" << hoge << "]: " << x[hoge] << endl
using namespace std;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  string S;
  cin >> S;
  int ans = 0;
  for (int i = 0; i + 2 < N; i++) {
    if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C') ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3568
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Dish[] dishes = new Dish[n];
		for (int i = 0; i < n; i++) {
			dishes[i] = new Dish(sc.nextInt(), sc.nextInt());
		}
		Arrays.sort(dishes, new Comparator<Dish>() {
		public int compare(Dish d1, Dish d2) {
			return (d2.a + d2.b) - (d1.a + d1.b);
		}
		});
		long sum = 0;
		for (int i = 0; i < n; i++) {
			if (i % 2 == 0) {
				sum += (long)(dishes[i].a);
			} else {
				sum -= (long)(dishes[i].b);
			}
		}
		System.out.println(sum);
	}
	
	static class Dish {
		int a;
		int b;
		public Dish(int a, int b) {
			this.a = a;
			this.b = b;
		}
	}
}


Measured memory_bytes: 93884
#pragma region
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = n; i > 0; i--)
#define repc(i, m, n) for (int i = m; i < n; i++)
#define reprc(i, m, n) for (int i = m; i > n; i--)
#define all(v) v.begin(), v.end()
#define INF 1e9
#define EPS 1e-10
using namespace std;
typedef long long ll;
#pragma endregion

int main()
{
    string S,T;
    cin >> S >> T;

    string U = T.substr(0, S.size());

    if(S == U){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    } 
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    int N;
    cin >> N;
    vector<int>a(N); 
    int ans = 0;
    for(int i = 0; i < N; i++) {
        cin >> a[i];
        ans+=a[i]-1;
    }
    cout << ans << endl;
}

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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define jRep(i, init, n) for (int i = init; i < (int)(n); i++)

const int64_t FPN_GE_10E9 = 10e9 + 7;
const int64_t FPN_LE_10E9 = 998244353;

int64_t mod64p(int64_t a, int64_t b) { return a - b * (a >= 0 ? a / b : a / b - 1); }


int main() {
    const string MSG_YN[] = {"No", "Yes"};
    const string MSG_ON[] = {"NG", "OK"};
    int K;
    cin >> K;
    string s = "ACL", d = "ACL";
    rep(i, K-1) s.append(d);
    cout << s << endl;
    return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(b%a == 0) {
			System.out.println(a+b);
		}else {
			System.out.println(b-a);
		}
	}
}


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

int main() {
    int n;
    cin >> n;
    int a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }
    long long result = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            bool valid = true;
            for (int k = 0; k < n; k++) {
                if (a[i][k] + a[k][j] < a[i][j]) {
                    result = -1;
                    goto end;
                }
                if (k != i && k != j && a[i][k] + a[k][j] == a[i][j]) {
                    valid = false;
                }
            }
            if (valid) {
                result += a[i][j];
            }
        }
    }
    end:
    cout << result;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1000000;
#include <map>
#include <math.h>
 
using ll = long long;
using namespace std;

ll n, k;
const ll mod = 1000000007;



int main(){
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    out((H-h)*(W-w));
}

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

int calc(int n, int k) {
   if ( n == k) return 0;
   else if ( n > k ) return n - k;
   else {
      if ( (k - n) % 2 == 0) return (k - n) / 2;
      else return (k - n) / 2 + 2;
   }
}

int main() {

   int A, B, C;
   std::cin >> A >> B >> C;

   int min = A;
   int max = A;

   if (min > B) min = B;
   if (min > C) min = C;
   if (max < B) max = B;
   if (max < C) max = C;

   int ans = A + B + C;
   for (int i = min - 2; i <= max + 2; i++) {
      int tmp = 0;
      tmp += calc(A, i);
      tmp += calc(B, i);
      tmp += calc(C, i);
      if (tmp < ans) ans = tmp;
   }
   std::cout << ans << std::endl;
   return 0;
}


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

int main(){
    ll n;
    cin>>n;
    ll s[100000];
    for(ll i=0;i<n;i++){
        cin>>s[i];
    }
    ll q;
    cin>>q;
    ll t[50000];
    for(ll i=0;i<q;i++){
        cin>>t[i];
    }
    int count=0;
    for(ll i=0;i<q;i++){
        ll left=0;
        ll right=n;
        while(left<right){
            ll mid=(left+right)/2;
            if(t[i]==s[mid]){
                count++;
                break;
            }else if(t[i]<s[mid]){
                right=mid;
            }else{
                left=mid+1;
            }
        }
    }
    cout<<count<<endl;
}


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


int main(){
int a;
string s;
cin >> a>>s;
if(a>=3200) cout << s<<endl;
else cout<<"red"<<endl;
}

Measured memory_bytes: 256
import sys 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n = ni()
v = na()
v.sort(reverse=False)
ans = v[0]

for vi in v[1:]:
        ans = (ans + vi) / 2

print(ans)

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

double D[3001][3001];

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

	double P[3001];

	for (int i = 1; i <= N; i++) {
		cin >> P[i];
	}

	D[0][0] = 1;

	for (int i = 1; i <= N; i++) {
		D[0][i] = D[0][i - 1] * (1. - P[i]);
	}
	for (int i = 1; i <= N; i++) {
		D[i][0] = D[i - 1][0] * P[i];
	}

	double ans = 0;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j + i <= N; j++) {
			D[i][j] = D[i][j - 1] * (1. - P[i + j]) + D[i - 1][j] * P[i + j];
			if (i + j == N && i > j) ans += D[i][j];
		}
	}

	printf("%.15lf", ans);

	/*
	int a , b;

	while (a != -1) {
		cin >> a >> b;

		cout << D[a][b] << endl;
	}

	*/
}


Measured memory_bytes: 70016
#include <iostream> 
#include<cmath>
#include<iomanip>
using namespace std;  
int main()  
{  
    int x[10];
    int alter;
    int flag = 1;
    for(int i =0;i < 10;i++)
    {
    	cin>>x[i];
    	if(x[i] < 0 || x[i] > 10000)
		  break;	
	}
	while(flag == 1)
	{
		flag = 0;
		for(int i =0;i < 10;i++)
		{
			if(x[i - 1] > x[i])
			{
				alter = x[i];
				x[i] = x[i - 1];
				x[i - 1] = alter;
				flag = 1;
			}
		}
	}
	cout<<x[9]<<endl;
	cout<<x[8]<<endl;
	cout<<x[7]<<endl;
	return 0;
} 


Measured memory_bytes: 3096
#include <bits/stdc++.h> 
#define rr(i,n)  for(int i=0; i<n; i++)
#define ol(a) cout << a << endl;
#define PI 3.14159265359
using namespace std;

int main(){
  int64_t a,b,h,m;  cin >> a >> b >> h >> m;
  //string s; cin >> s;
  int tisa = h*60+m;
  double lon = (tisa*6)%360; //ol(lon);
  double sho = tisa*0.5; //ol(sho);
  double sa = abs(lon - sho);
  if(sa > 180){
    sa = 360 - sa;
  }
  //ol(sa);
  //ol(PI);
  sa = sa*PI/180;
  double c = sqrt(a*a + b*b - 2*a*b*cos(sa));
  //ol(c)
  
  
  
  
  
  cout << fixed << setprecision(11);
  ol(c)
  
  
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()
const long long INF = 1e18;
using namespace std;
typedef long long ll;
int main() {
  ll N;
  cin >> N;
  ll a[3 * N];
  REP(i, 3 * N) cin >> a[i];
  sort(a, a + 3 * N);

  ll cnt = 0;
  ll i = 3 * N - 2;
  ll sum = 0;
  while (cnt < N) {
    sum += a[i];
    i -= 2;
    cnt++;
  }
  cout << sum;
  return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,m,i,j,hz,d[1010][1010],b[1010][1010],dx[5]={0,0,0,1,-1},dy[5]={0,1,-1,0,0};
char a[1010][1010];
queue<pair<ll,ll> > q;
pair<ll,ll>  u;
int main()
{
//	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>m;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++)
		{
			cin>>a[i][j];
			if(a[i][j]=='#')
				hz++;
		}
	memset(d,-1,sizeof(d));
	q.push(mp(1,1));
	d[1][1]=1;
	b[1][1]=1;
	while(!q.empty())
	{
		u=q.front();
		q.pop();
	//	cout<<u.fi<<" "<<u.se<<"\n";
		if(u.fi<1||u.fi>n||u.se<1||u.se>m||a[u.fi][u.se]=='#')
			continue;
		for(i=1;i<=4;i++)
		{
			if(b[u.fi+dx[i]][u.se+dy[i]]==0)
			{
				b[u.fi+dx[i]][u.se+dy[i]]=1;
				d[u.fi+dx[i]][u.se+dy[i]]=1+d[u.fi][u.se];
				q.push(mp(u.fi+dx[i],u.se+dy[i]));
			}
		}
	}
//	cout<<d[n][m]<<"\n";
	if(d[n][m]==-1)
	{
		cout<<-1<<"\n";
	}
	else
	{
		cout<<n*m-hz-d[n][m]<<"\n";
	}
}

Measured memory_bytes: 9344
#include<cstdio>

int main(){
	int h,w;
	scanf("%d %d", &h, &w);
	while(h && h){
		for(int i = 0; i < h ; i++){
			for(int j = 0; j < w; j++){
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d", &h, &w);
	}
}

Measured memory_bytes: 1004
#include<stdio.h>
int main()
{
    int a,b,c,d;
    // スペース区切りの整数の入力
    scanf("%d %d",&a,&b);
c=a*b;
 d=c%2;
if(d==0){
   // 出力
    printf("Even\n");
}
else{
   // 出力
    printf("Odd\n");
}

    return 0;
}


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



int main(){    
    int N;
    cin >> N;
    vector<int> x(N),y(N);
    rep(i,N) cin >> x[i] >> y[i];

    double l = 0.0;
    int c = N*(N-1)/2;
    for(int i = 0;i<N;i++){
        for(int j = i+1;j<N;j++){
            long long k = (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
            l += sqrt(k)/c;
        }
    }
    cout << setprecision(9) <<l*(N-1);
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
const int maxn=5e5+10;
const int N=5e5+10;
//vector<pair<int,int> >E[maxn];
int mp[1005][1005];
int n,m,s,t;
int vis[maxn];
int d[maxn];
struct node{
	int to;
	int next;
	int dis;
}edge[N];
priority_queue<pair<int,int> >q;
int head[N],num_edge,u,v,_d,base,dist[N];
queue<int>Q;//编号队列 
void edge_add(int from,int to,int dis){
	edge[++num_edge].next=head[from];
	edge[num_edge].to=to;
	edge[num_edge].dis=dis;
	head[from]=num_edge;
}
void djs(int s){
    memset(vis,0,sizeof(vis));
    //vis[i] 为1表示点i属于S集合 为0表示点i属于T集合
    memset(d,0x3f3f3f3f,sizeof(d));
    d[s]=0;
    q.push(make_pair(0,s));
    while(!q.empty()){
    	int x=q.top().second;
    	q.pop();
    	if(vis[x])continue;
    	vis[x]=1;
    	for(int i=head[x];i;i=edge[i].next){
    		int y=edge[i].to;
    		int z=edge[i].dis;
    		if(d[y]>d[x]+z){
    			d[y]=d[x]+z;//松弛
				q.push(make_pair(-d[y],y)); 
			}
		}
    	
	}
}
map<int,int>mpp;
int main()
{
    int x,y;
    cin>>n>>x>>y;
    num_edge=0;
    int u,v,w;
    memset(mp,0x3f3f3f3f,sizeof(mp));
    for(int i=1;i<n;++i){
        u=i;
        v=i+1;
        w=1;
        edge_add(u,v,w);
        edge_add(v,u,w);
		//mp[u][v]=w;
        //E[u].push_back(make_pair(v,w));
        //E[v].push_back(make_pair(u,w));
    }
     ///for(int i=1;i<n;++i){
        u=x;
        v=y;
        w=1;
        edge_add(u,v,w);
        edge_add(v,u,w);
    for(int i=1;i<=n;++i){
    	djs(i);
        for(int j=i+1;j<=n;++j){
            mpp[d[j]]++;
        }
	}
    for(int i=1;i<n;++i){
        cout<<mpp[i]<<"\n";
    }
    return 0;
}



Measured memory_bytes: 12032
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[10];
		for(int i=0;i<10;i++){
			a[i]= sc.nextInt();
		}
		Arrays.sort(a);
		System.out.println(a[9]);
		System.out.println(a[8]);
		System.out.println(a[7]);
	}
}

Measured memory_bytes: 17168
#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<30)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long
int a[30];

signed main(){
	int n;
	cin>>n;
	lp(i,n)cin>>a[i];
	int cnt=0;
	lp(i,n-1){
		if(i==0) continue;
		vector<int> v;
		v.push_back(a[i-1]);
		v.push_back(a[i]);
		v.push_back(a[i+1]);
		sort(v.begin(),v.end());
		if(v[1]==a[i]) cnt++;
		if(v[1]==a[i]&&v[1]==v[2]) cnt--;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

pair<int,int> bs[200000];

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,m; cin >> n >> m;
    for(int i=0;i<n;i++){
        bs[i].first=bs[i].second=i;
    }
    vector<pair<int,int>> v(m);
    for(int i=0;i<m;i++){
        cin >> v[i].first >> v[i].second;
    }
    sort(v.begin(), v.end());
    for(int i=0;i<m;i++){
        int x=v[i].second;
        bs[x-1].first=bs[x].first;
        bs[x].second=bs[x-1].second;
    }
    for(int i=0;i<n;i++){
        if(i)printf(" ");
        printf("%d",bs[i].first-bs[i].second+1);
    }
    printf("\n");
}



Measured memory_bytes: 5208
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main(){

    int N,ans=1;
    cin>>N;
    while(1){
        if(ans*ans>N)break;
        ans++;
    }

    cout<<(ans-1)*(ans-1)<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

		while (true) {
			int a = scn.nextInt();
			String op = scn.next();
			int b = scn.nextInt();
			if (op != null && op.equals("?")) {
				break;
			} else if (op != null && op.equals("+")) {
				System.out.println(a + b);
			} else if (op != null && op.equals("-")) {
				System.out.println(a - b);
			} else if (op != null && op.equals("*")) {
				System.out.println(a * b);
			} else if (op != null && op.equals("/")) {
				System.out.println(a / b);
			}
		}

	}
}



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

class D
{
	static int[] Read() => Console.ReadLine().Split().Select(int.Parse).ToArray();
	static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		var a = Read();
		var b = Read();

		var p2 = Enumerable.Range(0, n + 1).Select(i => 1 << i).ToArray();
		var rn = Enumerable.Range(0, n).ToArray();

		var m = 1 << 30;
		for (int x = 0; x < p2[n]; x++)
		{
			var c = Array.ConvertAll(rn, i => (x & p2[i]) == 0 ? (a[i], false) : (b[i], true));
			m = Math.Min(m, Swap(c));
		}
		Console.WriteLine(m == 1 << 30 ? -1 : m);

		int Swap((int v, bool rev)[] c)
		{
			var g = Array.ConvertAll(c, _ => _.v);
			Array.Sort(g);
			var u = new bool[n];

			var map = new int[n];
			for (int i = 0; i < n; i++)
			{
				map[i] = -1;
				for (int j = 0; j < n; j++)
				{
					if (u[j] || g[i] != c[j].v || (i - j) % 2 != 0 != c[j].rev) continue;
					u[j] = true;
					map[i] = j;
					break;
				}
				if (map[i] == -1) return 1 << 30;
			}

			var t = 0;
			for (int i = 0; i < n; i++)
				for (int j = i + 1; j < n; j++)
					if (map[i] > map[j]) t++;
			return t;
		}
	}
}


Measured memory_bytes: 46976
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
char c[100];
int main()
{
    scanf("%s",c);
    ll u=0;
    ll ans=0;
    for(ll i=0;i<3;i++)
    {
        if(c[i]=='R')
            u++;
        else
            u=0;
        ans=max(ans,u);
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 3756
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

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

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    ll x,n; cin >> x >> n;
    vector<ll> used(110);
    ll ans = 110;
    vector<ll> p(n);
    for(int i = 0; i < n; i++){
        cin >> p[i];
        used[p[i]] = 1;
    }

    rrep(i,110,0){
        if(used[i])continue;
        if(abs(ans - x) >= abs(i - x))ans = i;
    }

    cout << ans << endl;

}

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

using namespace std;

#define int long long int
#define REDBULL ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define endl "\n"

// bool isPerfectSquare(long double x) 
// {   
  
//   long double sr = sqrt(x);
//   return ((sr - floor(sr)) == 0); 
// } 
// bool isPrime(int n) 
// { 
//     // Corner case 
//     if (n <= 1) 
//         return false; 
  
//     // Check from 2 to n-1 
//     for (int i = 2; i < n; i++) 
//         if (n % i == 0) 
//             return false; 
  
//     return true; 
// } 
  
int32_t main()
{
	REDBULL
	int n;
	cin>>n;
	set<int> set1;
	for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            // If divisors are equal, print only one 
            if (n/i == i) 
               {
               	set1.insert(i);
               } ///printf("%d ", i); 
  
            else{
            	set1.insert(i);
            	set1.insert(n/i);
            } // Otherwise print both 
                //printf("%d %d ", i, n/i); 
        } 
    } 
    set<int > ans;

    for(auto it=set1.begin();it!=set1.end();it++)
    {
    	if(n%*it==0)

    	{
    		int check=n/(*it);
    		ans.insert(check-1+*it-1);
    	}
    }
    auto f=ans.begin();
    cout<<*f<<endl;
    return 0;
}

Measured memory_bytes: 768
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[55];
	for(int i=0;i<n;i++){
		cin >> a[i];
	}
	int t=0;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			t=t+a[i]*a[j];
		}
	}
	cout << t;
} 

Measured memory_bytes: 256