akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

bool yes[1010];

int main()
{
	int x;
	scanf("%d",&x);
	memset(yes,false,sizeof(yes));
	yes[1]=true;
	for(int i=2;i<=(int)sqrt(x);i++)
	{
		int cnt=i;
		for(;;)
		{
			cnt*=i;
			if(cnt>x) break;
			yes[cnt]=true;
		}
	}
	for(int i=x;i>=1;i--)
	{
		if(yes[i])
		{
			printf("%d\n",i);
			break;
		}
	}
	return 0;
}

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

int N;
vector<long long> x, y;

int solve() {
	if (N == 1) return 1;

	int res = N;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N; ++j) {
			if (i == j) continue;
			long long dx = x[j] - x[i], dy = y[j] - y[i];

			int sub = 0;
			for (int i2 = 0; i2 < N; ++i2) {
				for (int j2 = 0; j2 < N; ++j2) {
					if (j2 == i2) continue;
					if (dx == x[j2] - x[i2] && dy == y[j2] - y[i2]) ++sub;
				}
			}
			res = min(res, N - sub);
		}
	}
	return res;
}

int main() {
	cin >> N;
	x.resize(N); y.resize(N);
	for (int i = 0; i < N; ++i) cin >> x[i] >> y[i];
	cout << solve() << endl;
}

Measured memory_bytes: 256
list1 = input().split()
n = int(list1[0])
m = int(list1[1])
pre = [[] for i in range(n)]

for j in range(m):
    data = input().split()
    p = int(data[0])
    y = int(data[1])
    pre[p - 1].append((j, y))

inums = [0 for z in range(m)]
for k in range(n):
    if len(pre[k]) == 0:
        pass
    else:
        sorted_y = sorted(pre[k], key = lambda x:x[1])
        for l in range(len(sorted_y)):
            s1 = str(k + 1).zfill(6)
            s2 = str(l + 1).zfill(6)
            inums[sorted_y[l][0]] = s1 + s2

for h in range(m):
    print(inums[h])

Measured memory_bytes: 36020
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int n;
    cin >> n;
    vector<pair<pii, int>> v(n);
    REP(i, n){
        cin >> v[i].fi.fi >> v[i].fi.se >> v[i].se;
    }

    auto f = [](pair<pii, int> p, int cx, int cy){
        if(p.se == 0) return 0;
        return p.se + abs(p.fi.fi - cx) + abs(p.fi.se - cy);
    };
    auto f2 = [](int H, int x, int y, int cx, int cy){
        return max(H - abs(x-cx) - abs(y - cy), 0);
    };

    REP(i, 101){
        REP(j, 101){
            // vector<int> h(n);
            // REP(k, n){
            //     h[k] = f(v[k], i, j);
            // }
            // SORT(h);
            // int it = 0;
            // REP(k,n) if(h[k] != 0){
            //     it = k;
            //     break;
            // }
            // if(h[it] == h[n-1]){
            //     pr(i,j,h[it]);
            //     return 0;
            // }
            int h = 0;
            REP(k, n){
                h = f(v[k], i, j);
                if(h != 0) break;
            }
            bool flag = true;
            REP(k, n){
                if(v[k].se != f2(h, v[k].fi.fi, v[k].fi.se, i, j)){
                    flag = false;
                    break;
                }
            }
            if(flag){
                pr(i, j, h);
            }
        }
    }
}

Measured memory_bytes: 256
#pragma GCC optimize("trapv")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
//using arr = array;
using pi = pair<int, int>;
using vi = vector<ll>;
using vvi = vector<vi>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 1<<18, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n,m,qsz = 0;
vi g[maxn];
vi q[maxn];
int vis[maxn];
vi st;
int bip, csz;

void dfs(int v, int c = 1) {
	csz++;
	vis[v] = c;
	for(auto &i : g[v]) {
		if(c == vis[i]) bip = 0;
		if(!vis[i]) dfs(i, c^3);
	}
}

ll count() {
	ll i, b, u;
	i = b = u = 0;
	for(int v = 1; v <= n; v++) {
		if(vis[v]) continue;
		bip = 1, csz = 0;
		dfs(v);
		if(csz == 1) i++;
		else if(bip) b++;
		else u++;
	}
	return i * 2 * n - i*i + 2*b*(b+u) + u*u;
}
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n >> m;
	for(int f, t, i = 0; i < m; i++) {
		cin >> f >> t;
		g[f].pb(t);
		g[t].pb(f);
	}
	cout << count();
}


Measured memory_bytes: 22016
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define SORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
using ll = long long;
using namespace std;

int main(){
    string a, b, c;
    char flag = 'a';
    cin >> a >> b >> c;
    while(1){
        if(flag == 'a'){
            if(a.length() == 0){
                cout << "A" << endl;
                break;
            }
            flag = a[0];
            a = a.substr(1, a.length() - 1);
        }else if(flag == 'b'){
            if(b.length() == 0){
                cout << "B" << endl;
                break;
            }
            flag = b[0];
            b = b.substr(1, b.length() - 1);
        }else{
            if(c.length() == 0){
                cout << "C" << endl;
                break;
            }
            flag = c[0];
            c = c.substr(1, c.length() - 1);
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

const long long INF = 1LL << 60;

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

  map<int, int> mp;
  rep(i, n){
    int a; cin >> a;
    mp[a]++;
  }

  int cnt = 0;
  for(auto p : mp){
    if(p.second % 2 == 1){
      cnt++;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 4864
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M;
  cin >> N >> M;
  priority_queue<long long> p;
  for(int i=0; i<N; i++){
    long long a;
    cin >> a;
    p.push(a);
  }
  for(int i=0; i<M; i++){
    long long b;
    b = p.top();
    p.pop();
    b /= 2;
    p.push(b);
  }
  long long ans=0;
  for(int i=0; i<N; i++){
    ans += p.top();
    p.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4320
#include<stdio.h>
#include<ctype.h>
main(){
	char ch;

	while(1){
		scanf("%c",&ch);
		if(islower(ch)){
			ch = toupper(ch);
		}
		else if(isupper(ch)){
			ch = tolower(ch);
		}
		printf("%c",ch);

		if(ch == '\n') break;
	}
	return 0;
}

Measured memory_bytes: 940
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) printf("%2lld ", e); cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(ll, n+1, a);
    if(n == 0){
        if(a[0] == 1) Return(1);
        Return(-1);
    }
    
    vc<ll> lb(n+1), ub(n+1);
    lb[n] = ub[n] = 0;
    for(int i = n-1; i >= 0; i --){
        lb[i] = (a[i+1] + lb[i+1] + 1)/2;
        ub[i] = a[i+1] + ub[i+1];
    }
    /*Couts(a);
    Couts(lb);
    Couts(ub);*/
    if(a[0] > 0 || lb[0] > 1) Return(-1);
    ll ans = 1, p = 1;
    // cout << " 0 ";
    for(int i = 1; i <= n; i ++){
        p = min(2*p - a[i], ub[i]);
        ans += p;
        // printf("%2lld ", p);
    }
    // Cout();
    For(i, n+1) ans += a[i];
    Cout(ans);
}




Measured memory_bytes: 5636
#include<iostream>
#include<vector>
#include<string.h>
#include<algorithm>
#include<set>
#include<map>
using namespace std;

const int MOD=1000003;
int N,M;
vector<vector<int> > L;
int ans=0;
map<pair<int,int> ,int> memo;


long long calc(int start,int end){
//	cout<<"do "<<start<<" "<<end<<endl;
	if((end-start)%2==0) return 0;
	if(start>end) return 1;
	if(memo.count(make_pair(start,end))) return memo[make_pair(start,end)];
	long long res=1;

	int now=start;
	if(L[now].size()==0){
		while(now<=end && L[now].size()==0) now+=2;
		return calc(now,end);
	}
	else{
		res=0;
		for(int k=0;k<L[now].size();k++){
			res+=(calc(now+1,L[now][k]-1)*calc(L[now][k]+1,end))%MOD;
			res%=MOD;
		}
	}
	res+=calc(now+2,end);
	res%=MOD;
	memo[make_pair(start,end)]=res;
//	cout<<"res "<<start<<" "<<end<<" :"<<res<<endl;
	return res%MOD;
}

int main()
{
	while(cin>>N>>M && N!=0){
		memo.clear();
		L.clear();
		L.resize(N,vector<int>());

		for(int i=0;i<M;i++){
			int in,out;cin>>in>>out;
			in--;out--;
			if(in<out)
				L[in].push_back(out);
			else
				L[out].push_back(in);
		}
		for(int i=0;i<N;i++){
			sort(L[i].begin(),L[i].end());
			L[i].erase(unique(L[i].begin(),L[i].end()),L[i].end());
		}
		cout<<(calc(0,N-1)+calc(1,N-2))%MOD<<endl;
	}
}

Measured memory_bytes: 8140
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <utility>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	vector<int> a(4);
	vector<int> b(4);

	string sa;
	for (; getline(cin, sa);)
	{
		stringstream ssa;
		ssa << sa;

		for (int i = 0; i < 4; i++)
		{
			ssa >> a.at(i);
		}

		string sb;
		getline(cin, sb);
		stringstream ssb;
		ssb << sb;

		int hit = 0;
		int blow = 0;
		for (int i = 0; i < 4; i++)
		{
			ssb >> b.at(i);
			if (a.at(i) == b.at(i))
			{
				hit++;
			}
		}

		sort(a.begin(), a.end());
		sort(b.begin(), b.end());

		for (int i = 0; i < 4; i++)
		{
			if (a.at(i) == b.at(i))
			{
				blow++;
			}
		}

		blow -= hit;
		if (blow < 0)
		{
			blow = 0;
		}

		cout << hit << " " << blow << endl;
	}
}



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

const string YES = "Yes";
const string NO = "No";

void solve(long long A, long long B, long long C, long long D){
    if (ceil(1.0 * C / B) <= ceil(1.0 * A / D)) {
        cout << YES << endl;
    } else {
        cout << NO << endl;
    }

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long C;
    scanf("%lld",&C);
    long long D;
    scanf("%lld",&D);
    solve(A, B, C, D);
    return 0;
}


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

#define pb push_back
#define mp make_pair
#define fs first
#define se second
#define pi 2*acos(0)
#define PI 3.14159265358979323846264338

typedef long long ll;
typedef pair < int , int > pii;
typedef pair < ll , ll > pll;
const int N = 100010;

inline int in() {int x; scanf("%d",&x); return x;}
inline ll lin() {ll x; scanf("%lld",&x); return x;}

int fx[]={1,-1,0,0};
int fy[]={0,0,-1,1};

int main(){
    int a = in(), b = in();
    cout << a - 1 + (b >= a) << '\n';
    return 0;
}


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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

#define F first
#define S second
#define MAX 10000003
using namespace std;

using ll = int64_t;
const int64_t mod = 1000000007;

int64_t prime[MAX];
unordered_map<int64_t, int64_t> max_map;

// Function to return a^n
int64_t power(int64_t a, int64_t n) {
  if (n == 0) return 1;
  int64_t p = power(a, n / 2) % mod;
  p = (p * p) % mod;
  if (n & 1) p = (p * a) % mod;
  return p;
}

// Function to find the smallest prime factors
// of numbers upto MAX
void sieve() {
  prime[0] = prime[1] = 1;
  for (int64_t i = 2; i < MAX; i++) {
    if (prime[i] == 0) {
      for (int64_t j = i * 2; j < MAX; j += i) {
        if (prime[j] == 0) {
          prime[j] = i;
        }
      }
      prime[i] = i;
    }
  }
}

// Function to return the LCM modulo M
ll lcmModuloM(const int64_t *ar, int64_t n) {
  for (int64_t i = 0; i < n; i++) {
    int64_t num = ar[i];
    unordered_map<int64_t, int64_t> temp;

    // Temp stores mapping of prime factor to
    // its power for the current element
    while (num > 1) {
      // Factor is the smallest prime factor of num
      int64_t factor = prime[num];

      // Increase count of factor in temp
      temp[factor]++;

      // Reduce num by its prime factor
      num /= factor;
    }

    for (auto it : temp) {
      // Store the highest power of every prime
      // found till now in a new map max_map
      max_map[it.first] = max(max_map[it.first], it.second);
    }
  }

  ll ans = 1;

  for (auto it : max_map) {
    // LCM is product of primes to their highest powers modulo M
    ans = (ans * power(it.F, it.S)) % mod;
  }

  return ans;
}
template <typename T>
T modinv(T a, const T m) {
  T b = m, u = 1, v = 0;
  while (b != 0) {
    const auto t = a / b;
    a -= t * b;
    std::swap(a, b);
    u -= t * v;
    std::swap(u, v);
  }
  u %= m;
  if (u < 0) {
    u += m;
  }
  return u;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> a(n);
  std::cin >> a;

  sieve();
  constexpr int64_t mod = 1000000007;

  int64_t rhs = lcmModuloM(a.data(), n);

  int64_t ans = 0;

  for (const auto i : a) {
    ans += (rhs * modinv(i, mod)) % mod;
    ans %= mod;
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 78848
#include <iostream>

using namespace std;

int main(){
    int a;
    int b;
    int c;
    cin >> a >> b >> c;
    if((a == 5 && b == 5 && c == 7) || (a == 5 && b == 7 && c == 5) || (a == 7 && b == 5 && c == 5)){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

int main(){
  int M, N, P[10000], C[500], E[500];
  cin >> M >> N;
  for(int i = 0; i < M; i++){
    cin >> P[i];
  }
  sort( P, P + M, greater< int >());

  for(int i = 0; i < N; i++){
    cin >> C[i] >> E[i];
  }

  int dp[50001]; //dp[i]:饅頭をi個以上入れるための箱の値段の最小値
  fill_n( dp, 50001, INF);
  dp[0] = 0;
  for(int i = 0; i < N; i++){
    for(int j = M; j >= 0; j--){
      if(dp[j] != INF){
        dp[ min( M, j + C[i])] = min( dp[ min( M, j + C[i])], dp[j] + E[i]);
      }
    }
  }

  int sum[10001];
  sum[1] = P[0];
  for(int i = 2; i <= M; i++){
    sum[i] = sum[i - 1] + P[i - 1];
  }

  int ret = 0;
  for(int i = 1; i <= M; i++){
    if(dp[i] != INF) ret = max( ret, sum[i] - dp[i]);
  }
  cout << ret << endl;
  return(0);
}

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

int main() {
  int n;
  cin>>n;
  bool three = true;
  for(int i=0;i<n;i++){
    string color;
    cin>>color;
    if (color=="Y")
      three = false;
  }
  if(three == false)
    cout<<"Four"<<endl;
  else
    cout<<"Three"<<endl;
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//String s = sc.next();
		//String t = sc.next();
		//String g = sc.next();
		long n = sc.nextLong();
		long m = sc.nextLong();
		long k = sc.nextLong();
		//long l = sc.nextLong();
		//String buff="Christmas";
		long count=0;
		long[] array=new long[3];

		/*for(long i=n;i<25;i++) {
			buff+=" Eve";
		}*/
		Arrays.sort(array);

		/*if() {
			System.out.println("TBD");
		}else {
			System.out.println("Heisei");
		}*/
		System.out.println(Math.min(m/n,k));
		//System.out.println(Math.abs(array[2]-array[1])+Math.abs(array[1]-array[0]));
	}
}




Measured memory_bytes: 23252
use std::io::*;
use std::str::FromStr;

fn main() {
	let (n, k): (usize, u32) = (read(), read());
	let mut v = vec![0; n];
	let mut d: usize;
	let mut temp: usize;
	for _ in 0..k {
		d = read();
		for _ in 0..d {
			temp = read();
			v[temp-1] += 1;
		}
	}
	let mut cnt: usize = 0;
	for i in &v {
		if *i == 0 { cnt += 1; }
	}
	println!("{}", cnt);
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}


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


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

struct edge {int to; ll cost; };

int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  string s, t;
  cin >> s >> t;
  cout << t << s << endl;
  return 0;
}


Measured memory_bytes: 3612
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<string>
#include<functional>
using namespace std;
typedef	long long int ll;

int main(){
    int a, b;
    cin >> a >> b;
    if(a+b==15) cout << "+" << endl;
    else if(a*b==15) cout << "*" << endl;
    else cout << "x" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
            int N = sc.nextInt();
            String S = sc.next();
            int K = sc.nextInt();
        sc.close();
        
        String[] text = new String[N];
        for (int i = 0; i < N; i++) {
            text[i] = String.valueOf(S.charAt(i));
        }
        
        String rep = text[K-1];

        String ans = "";
        for (int i = 0; i < N; i++) {
            if(!rep.equals(text[i])){
                text[i] = "*";
                ans = ans + text[i];
            }else{
                ans = ans + text[i];
            }
         }

         System.out.println(ans);

    }
}

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

int main() {
	int n; cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) cin >> a[i];

	long long ans = 0;
	int right = 0;
	int sum = 0; 
	for (int left = 0; left < n; ++left) {
		while (right < n && (sum ^ a[right]) == (sum + a[right])) {
			sum += a[right];
			++right;
		}
		ans += right - left;
		if (left == right) ++right;
		else sum -= a[left];
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 1024
from collections import deque
h,w=map(int,input().split())

maze=[[i for i in input()] for _ in range(h)]

que=deque([[0,0]])

visited=[[0 for _ in range(w)] for _ in range(h)]
visited[0][0]=1

while que:
    n=que.popleft()
    x,y=n[0],n[1]

    if n==(h-1,w-1):
        break

    for i, j in [(1,0), (0,1)]:
        if (x+i >=w) or (y+j >=h) or maze[y+j][x+i] == '#':
            continue
        if visited[y+j][x+i] == 0:
            que.append([x+i,y+j])
        visited[y+j][x+i] += visited[y][x]

print(visited[h-1][w-1]%(10**9+7))


Measured memory_bytes: 311944
#include <iostream>

using namespace std;

int main(){
  int N, A, B, i, quiz1=0, quiz2=0, quiz3=0, tmp;
  cin >> N >> A >> B;
  int P[N];
  for(i=0; i<N; i++){
    cin >> P[i];
    if(P[i] <= A) quiz1++;
    else if(A+1 <= P[i] && P[i]<= B) quiz2++;
    else quiz3++;
  }
  if(quiz2 < quiz1){
    tmp = quiz2; quiz2 = quiz1; quiz1 = tmp;
  }
  if(quiz2 > quiz3){
    tmp = quiz3; quiz3 = quiz2; quiz2 = tmp;
  }
  if(quiz2 < quiz1){
    tmp = quiz2; quiz2 = quiz1; quiz1 = tmp;
  }
  cout << quiz1 << "\n";
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
struct aaa{
	ll x,y,val;
}a[1000001];
ll n,m,fa[1000001],d[1000001],tot,ans;
bool cmp(aaa a,aaa b){
	return a.val<b.val;
}
void build(ll t,ll k,ll s){
	tot++;
	a[tot].x=t;a[tot].y=k;a[tot].val=s;
}
ll find(ll x){
	if(x==fa[x])return x;
	return fa[x]=find(fa[x]);
}
int main(){
	ll i,t,k,s,now,x,y;
	memset(d,44,sizeof(d));
	scanf("%lld%lld",&n,&m);
	for(i=1;i<=m;i++){
		scanf("%lld%lld%lld",&t,&k,&s);
		build(t,k,s);
		d[t]=min(d[t],s+1);d[k]=min(d[k],s+2);
	}
	for(i=0;i<n;i++)d[i]=min(d[i],d[(i-1+n)%n]+2);
	//puts("-1");
	for(i=0;i<n;i++)d[i]=min(d[i],d[(i-1+n)%n]+2);
	for(i=0;i<n;i++)build(i,(i+1)%n,d[i]);
	//puts("-2");
	sort(a+1,a+tot+1,cmp);
	for(i=1;i<n;i++)fa[i]=i;
	now=n-1;
	for(i=1;i<=tot&&now;i++){
		//prllf("%d\n",i);
		x=find(a[i].x);y=find(a[i].y);
		if(x!=y){
			fa[x]=y;now--;
			ans+=a[i].val;
		}
	}
	printf("%lld",ans);
}

Measured memory_bytes: 23040
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010

int main() {
  int N, P;

  scanf("%d", &N);


  int minval = INF, ans = 0;

  for (int i=0; i<N; i++) {
    scanf("%d", &P);
    ans += minval > P;
    minval = min(minval, P);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 105;

#define endl "\n"

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	int n, b[N],sum;
	cin >> n;
	for (int i = 1; i < n; i++) cin >> b[i];
	b[0] = b[n] = inf;
	sum = 0;
	for (int i = 1; i <= n; i++) {
		sum += min(b[i-1], b[i]);
	}
	cout << sum << endl;
	return 0;
}

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

int main ()
{
    int i=0,j,l,cnt=0;
    string s;
    cin>>s;
    l=s.size()-1;


    while (l>i)
    {
        if(s[i++]!=s[l--])
        {
            cnt++;
        }
    }
    if (cnt==0)
        cout<<"0"<<endl;
    else
        cout<<cnt<<endl;

}


Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}


int dfs(int n,int N){
    if (n>N){
        return 0;
    }
    

    int ret;
    
    return ret;
}


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

    int tmp=0;

    FOR(i,S.length()){
        if(S[i]=='1'){
            tmp++;
        }else{
            tmp--;
        }
    }
    cout << S.length() - abs(tmp)<< endl;

    return 0;

    


}

Measured memory_bytes: 512
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};

struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(10);
  }
} iosetup;
/*-------------------------------------------------*/
int main() {
  int n; cin >> n;
  FOR(i, 1, 10) FOR(j, 1, 10) {
    if (i * j == n) {
      cout << "Yes\n";
      return 0;
    }
  }
  cout << "No\n";
  return 0;
}


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

using namespace std;

typedef long long LL;

#define fin "\n"


#define FOR(i,bg,ed) for(int i=(bg);i<(ed);i++)
#define REP(i,n) FOR(i,0,n)

template <typename T>
inline void chmin(T &l,T r){l=min(l,r);}

template <typename T>
inline void chmax(T &l,T r){l=max(l,r);}

template <typename T>
istream& operator>>(istream &is,vector<T> &v){
    for(auto &it:v)is>>it;
    return is;
}
string ok="YES";
string no="NO";
int main(){
    LL N;
    cin>>N;
    LL sum=0;
    vector<LL> A(N);
    vector<LL> B(N,0);
    vector<LL> C(N,0);
    REP(i,N){
        cin>>A[i];
        sum+=A[i];
    }
    LL M=N*(N+1)/2;
    if(sum%M!=0){
        cout<<no<<endl;return 0;
    }
    LL K=sum/M;
    LL num=0;
    REP(i,N){
        LL sa=A[(i+1)%N]-A[i]-K;
        if(sa%N!=0||sa>0){
            cout<<no<<endl;return 0;
        }
        num+=sa/-N;
        B[(i+1)%N]+=sa/-N;
    }
    if(num==K){
        num=0;
        sum=0;
        REP(i,N){
            num+=B[i];
            sum+=B[i];
            C[i]=sum;
            sum+=num;
        }
        REP(i,N){
            num-=B[i];
            sum-=B[i]*(N+1);
            C[i]+=sum;
            sum+=num;
            if(C[i]!=A[i]){
                cout<<no<<endl;return 0;
            }
        }
        cout<<ok<<endl;
            
    }
    else cout<<no<<endl;
    
    return 0;
}


Measured memory_bytes: 2560
n, m, x = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
p = float("inf")

for i in range(1, 2**n):
    s = [0]*m
    count = 0
    ps = 0
    for j in range(n):
        if (i >> j) & 1:
            ps += a[j][0]
            for k in range(m):
                s[k] += a[j][k+1]
                
    for k in range(m):
        if s[k] >= x:
            count += 1
            
    if count == m:
        p = min(ps, p)
        
if p == float('inf'):
    print(-1)
else:
    print(p)

Measured memory_bytes: 9228
#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 ask(int x,int y) {
	string S(200,'0');
	S[x]=S[y]='1';
	cout<<"? "<<S<<endl;
	int ret;
	cin>>ret;
	return ret;
}

vector<pair<int,int>> V;
int N;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(y,200) FOR(x,y) if(ask(x,y)==1) V.push_back({x,y});
	
	cout<<"!";
	FORR(r,V) cout<<" ("<<r.first<<","<<r.second<<")";
	cout<<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: 852
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const LL mod = 1e9 + 7;
const LL N = 1e6 + 5;
const LL M = 1e3 + 5;
#define FOR(i, n, m) for (int i = n; i <= m; i++)
#define mid ((l + r) >> 1)
#define lson (l, mid)
#define rson (mid + 1, r)
#define r(a) read(a)
#define rr(a, b) r(a), r(b)
#define rrr(a, b, c) rr(a, b), r(c)
#define rrrr(a, b, c, d) rrr(a, b, c), r(d)
int n, m, k, T;
template <class T>
T read(T &x) {
    T f = 1;
    x = 0;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = (x << 1) + (x << 3) + (ch - '0');
        ch = getchar();
    }
    x *= f;
}
LL qpow(LL a, LL b, LL p) {
    LL res = 1;
    while (b) {
        if (b & 1) res = (res * a) % p;
        a = (a * a) % p;
        b >>= 1;
    }
    return res;
}
LL ex_gcd(LL a, LL b, LL &x, LL &y) {
    if (!b) {
        x = 1, y = 0;
        return a;
    }
    LL res = ex_gcd(b, a % b, x, y);
    LL t = x;
    x = y;
    y = t - a / b * y;
    return res;
}
LL prime[N + 10], phi[N + 10], mou[N + 10], cnt_prime;
bool judgeprime[N + 10];
void ouler() {
    phi[1] = mou[1] = 1;
    FOR(i, 2, N) {
        if (!judgeprime[i]) prime[cnt_prime++] = i, phi[i] = i - 1, mou[i] = -1;
        for (int j = 0; j < cnt_prime && i * prime[j] <= N; j++) {
            judgeprime[i * prime[j]] = 1;
            if (i % prime[j] == 0) {
                phi[i * prime[j]] = phi[i] * prime[j];
                mou[i * prime[j]] = 0;
                break;
            } else {
                mou[i * prime[j]] = -mou[i];
                phi[i * prime[j]] = phi[i] * (prime[j] - 1);
            }
        }
    }
}
int main() {
    string a;
    cin >> a;
    int len = a.size();
    for (int i = 0; i < len; i++) putchar('x');
    return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep1(i,n) for(ll i=1;i<(ll)n;i++)
#define repf(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define repr(i,a,b) for(ll i=(ll)a-1;i>=(ll)b;i--)
#define Fi first
#define Se second
typedef pair<ll, ll> pll;
const ll MAX = 1000000000000000000;
const char END = '\n';


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

	string n; cin >> n;
	ll sum = 0;
	
	rep(i,n.length())
		sum += n[i] - '0';
	
	if (sum % 9 != 0)
		cout << "No";
	else
		cout << "Yes";
	cout << END;
	return 0;
}

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

int main(){
    int m, nmin, nmax;
    while(cin >> m >> nmin >> nmax, m+nmin+nmax){
        vector<int> p(m);
        for(int i = 0; i < m; i++)  cin >> p[i];
        sort(p.rbegin(), p.rend());
        int ans = 0, diff = 0;
        for(int i = nmin; i <= nmax; i++){
            if(p[i-1]-p[i] >= diff){
                ans = i, diff = p[i-1]-p[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<vi> vvi;
const int inf = 0x3f3f3f3f;
const ll linf = 123456789012345678;
const ll mod = 1000000007;
#define all(x) x.begin(), x.end()
#define debug(x) cerr << #x << " = " << x << endl
#define sz(x) ((int)(x).size())


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

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

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<queue>
#include<cmath>
#include<map>
#include<vector>
#include<iomanip>
using namespace std;
typedef long long ll;
ll inf = 100000000;
ll v[205];
ll x[20000005];
ll a[10000005];
ll b[10000005];
ll dp[10005][10005];
ll ex = 1000000007;
int dx[4] = { 1,-1,0,0 };
int dy[4] = { 0,0,1,-1 };
typedef pair<ll, ll> P;
double q[200005];
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

int main() {
	ll l, r;
	cin >> l >> r;
	if (r - l >= 2019) {
		cout << "0" << endl;
		return 0;
	}
	ll a = l % 2019;
	ll b = r % 2019;
	ll ans = inf;
	for (ll i = a; i < b; i++) {
		for (ll j = i + 1; j <= b; j++) {
			if (ans > (i * j) % 2019) {
				ans = (i * j) % 2019;
			}
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000007
#define mem(dp,a) memset(dp,a,sizeof dp)
#define flash ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
#define f(i,n) for (ll i=0;i<n;i++)
#define sieve(j,mp) for(ll j=2*i ; j<=mp ; j+=i)
#define pb(x) push_back(x)
#define mp(x,y) push_back(make_pair(x,y))
#define tr(c,it) for(((c).begin())it=(c).begin();it!=(c).end();it++)
#define test ll t=1; while(t--)
#define F first
#define S second
ll dp[21][(1<<21)+1];
main()
{
    flash
    test
    {
        ll n,mxn,path;
        cin>>n;
        mxn=1<<n;
        ll a[n][n];
        mem(dp,0);
        f(i,n) f(j,n)
        {
            cin>>a[i][j];
            if(!i)
            dp[i][1<<j]=a[0][j];
        }
        rep(i,1,n) f(j,n)
        if(a[i][j])
        {
            path=1<<j;
            rep(k,1,mxn)
            {
                if(k&path||dp[i-1][k]==0)continue;
                dp[i][path+k]+=dp[i-1][k];
                dp[i][path+k]=dp[i][path|k]%INF;
            }
        }
        cout<<dp[n-1][mxn-1]<<endl;
    }
    return 0;
}


Measured memory_bytes: 344320
import Data.List
import Data.List.Split
import Control.Arrow
main = mapM_ (putStrLn . solve) . chunksOf 2 . map (map read .words) . lines =<< getContents
solve [[n],as]
  |(any (\(x,y)->x+1/=y) . zip ds $ tail ds) = i
  |(any (<2) $ tail cs) = i
  |head ds-head cs+2/=length ds = i
  |otherwise = p
  where (ds,cs) = (map head &&& map length) . group . sort $ as
p = "Possible";
i = "Impossible";

Measured memory_bytes: 1020
#include<bits/stdc++.h>
#define ll long long int
#define MOD 1000000000
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
ll x[100005];
ll dp[100005];
for(int i=0;i<n;i++)
    cin>>x[i];
for(int i=0;i<n;i++)
    dp[i]=MOD;
  dp[0]=0;
  for(int i=0;i<n;i++)
  for(int j=1;j<=k;j++)
      if(i+j<n)
      dp[i+j]=min(dp[i+j],dp[i]+abs(x[i]-x[i+j]));
  cout<<dp[n-1];
}

Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int[] n = RIntAr();
            int max = Math.Min(n[1], n[2]);
            int min = n[1] + n[2] <= n[0] ? 0 : n[1] + n[2] - n[0];
            Console.WriteLine("{0} {1}", max, min);
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e10;

int main(){
    int N;
    cin >> N;
    vector<pair<int, int>> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i].first;
        A[i].second = i + 1;
    }
    sort(A.begin(), A.end());
    for(int i = 0; i < N; i++)cout << A[i].second << endl;
    return 0;
}

Measured memory_bytes: 1536
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String r = "AAA";
		String z ="BBB";
		if(s.equals(r)||s.equals(z)) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}
		
		
			
		
		
	}
}


Measured memory_bytes: 21716
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            while (!String.IsNullOrEmpty(s = Console.ReadLine()))
            {
                Console.WriteLine(
                    s.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
                     .Select(int.Parse)
                     .Aggregate((a, b) => a + b).ToString().Length);
            }
        }
    }
}

Measured memory_bytes: 6512
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列
using namespace std;

typedef long long ll;

//マクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))
#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7
#define MAXR 100000 //10^5:最大のrange(素数列挙などで使用)

int main(void){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int max_i = 0;
    int max_v = 0;
    int v = 0;
    REP(i, n) {
        if(s[i] == 'D') {
            v = v-1;
        } else {
            v += 1;
            if(max_v < v) {
                max_v = v;
                max_i = i+1;
            }
        }
    }
    cout << max_v << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
typedef long long ll;
#define rep(i,n) for(ll i=0; i<(ll)(n); i++)

int n, k[105], v[105][105], d[105] = {0}, f[105];
int dfs(int num, int cnt){
    cnt++;
    d[num] = cnt;
    for(int i = 0; i < k[num]; i++){
        if(d[v[num][i]] == 0) cnt = dfs(v[num][i], cnt);
    }
    cnt++;
    f[num] = cnt;
    return cnt;
}

int main(){
    scanf("%d", &n);
    rep(i, n) {
        int dummy;
        scanf("%d%d", &dummy, &k[i]);
        rep(j, k[i]){
            scanf("%d", &v[i][j]);
            v[i][j]--;
        }
    }
    
    int tmp = 0;
    rep(i, n){
        if(d[i] == 0) tmp = dfs(i, tmp);
    }
    rep(i, n){
        printf("%lld %d %d\n", i+1, d[i], f[i]);
    }
}


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

int main(){
    string s;
    cin >> s;
    for(char i='a';i<='z';i++){
        int cnt=0;
        rp(j,s.size()){
            if(s.at(j)!=i){
                cnt++;
            }
        }
        if(cnt==s.size()){
            cout << i << endl;
            goto Exit;
        }
    }
    cout << "None" << endl;
Exit:
    ;
    return 0;
}



Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#include <queue>
#include <map>

#define mod 1000000007
#define ten5 100005
#define PI 3.1415926
using namespace std;

int num[201];

int main()
{
    //int m,n,o=0,i,j,k;
    long long int sum=0,sum2=0,n1=0,n2=0,n3;
    double ans=0.0,half;
    long long int m,n,o,i,j,k=1,now=1;
    long long int a,a1,a2,a3,a4;
    //float f,g,h;
    char c;
    string s,s1;
    //priority_queue<int> pq;
    //map<string,int> mp;
    //map<string,int>::iterator iter;
    cin>>a1>>a2>>a3;
    cin>>k;
    a=max(a1,a2);
    a=max(a,a3);
    sum=a1+a2+a3-a;
    for(i=0;i<k;i++)
    {
        a=a<<1;
    }
    cout<<sum+a;
    return 0;
}



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

int main()
{
	int n;
	int k;
	cin >> n >> k;
	vector<int> l(n);
	for(int i = 0;i<n;i++)cin >> l[i];
	sort(l.begin(),l.end(),greater<>());
	int ans = 0;
	for(int i = 0;i<k;i++)ans += l[i];
	cout<<ans<<endl;
	return 0;
}


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl




typedef long long ll;
const ll mod = 1e9+7;
const int maxn = 1e6 + 5;



int r,c,n;

int score(int x, int y) {
    if (y == 0) {
	return r-x;
    }
    if (x == 0) {
	return r + y;
    }

    if (y == c) {
	return r+c+x;
    }

    if (x == r) {
	return r+c+r+(c-y);
    }

    assert(0);
}

bool cmp(pair<int,pair<int,int>> a, pair<int,pair<int,int>> b) {
    int xa = a.second.first;
    int ya = a.second.second;

    int xb = b.second.first;
    int yb = b.second.second;

    return score(xa,ya) < score(xb, yb);
}

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

    cin>>r>>c>>n;
    vector<pair<int,pair<int,int>>> pts;
    for (int i=0; i<n; i++) {
	vector<pair<int,int>> v;
	int x,y;
	cin>>x>>y;
	v.emplace_back(x,y);
	cin>>x>>y;
	v.emplace_back(x,y);
	bool ok = true;
	for (auto p: v) {
	    int x=p.first; int y=p.second;
	    if (x==0) {
	    } else if (x==r) {
	    } else if (y==0) {
	    } else if (y==c) {
	    } else {
		ok = false;
	    }
	}

	if (!ok) continue;

	for (auto p: v) {
	    int x=p.first; int y=p.second;
	    if (x==0) {
		pts.push_back({i, {x,y}});
	    } else if (x==r) {
		pts.push_back({i, {x,y}});
	    } else if (y==0) {
		pts.push_back({i, {x,y}});
	    } else if (y==c) {
		pts.push_back({i, {x,y}});
	    }
	}
    }


    sort(pts.begin(), pts.end(), cmp);

    stack<int> stk;

    for (auto p: pts) {
	int id = p.first;
	if (stk.empty() || stk.top()!=id) {
	    stk.push(id);
	} else {
	    stk.pop();
	}
    }

    // for (auto p : pts) {
    // 	cout<<p.first<<endl;
    // }

    if (stk.empty()) out("YES");
    out("NO");
  

    return 0;
}


Measured memory_bytes: 4852