akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        ans += 2 * min(x, k - x);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        String str = s.next();
        if(str.charAt(2) == str.charAt(3) && str.charAt(4) == str.charAt(5))
        System.out.println("Yes");
        else
        System.out.println("No");
    }
}

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

int main() {
  int n,A=1000000,Z=0;
  cin>>n;
  for(int i=0;i<n;i++){
    int a;
    cin>>a;
    if(a<=A){
      A=a;
      Z++;
    }
  }
  cout<<Z<<endl;
  
}

Measured memory_bytes: 256
N = int(input())
a = [int(input()) for _ in range(N)]

visited = [0 for _ in range(N)]

cnt = 0
idx = 0
visited[idx] = 1

while True:
    idx = a[idx] - 1
    cnt += 1
    if visited[idx]:
        cnt = -1
        break
    elif idx == 1:
        break
    
    visited[idx] = 1

print(cnt)

Measured memory_bytes: 7852
open Scanf
open Printf

let flip f x y = f y x

let rec range a b = if a >= b then [] else a :: range (a+1) b

let read_int () = scanf " %d" (fun x -> x)
let rec read_ints n = if n = 0 then [] else let i = read_int () in i :: read_ints (n-1)

let rec for_iter a b f = if a >= b then [] else let x = f a in x :: for_iter (a+1) b f
let rec for_iter_ a b f = if a >= b then () else (f a; for_iter_ (a+1) b f)

let list_of_string str = range 0 (String.length str) |> List.map (fun i -> str.[i])

type domino = H | V

let m = 1000000007

let mm x y = (x * y) mod m

let parse s =
  let rec f str = match str with
  | [] -> []
  | [_] -> [V]
  | (x::y::ys) -> if x = y then H :: f ys else V :: f (y::ys) in
  f (list_of_string s)

let calc xs =
  let f (p, a) x =
    match p, x with
    | H, H -> (H, mm 3 a)
    | H, V -> (V, a)
    | V, _ -> (x, mm 2 a) in
  match xs with
  | [] -> 1
  | (x::xs') ->
      let mult = match x with H -> 6 | V -> 3 in
      List.fold_left f (x, mult) xs' |> snd

let () =
  let _ = read_line () in
  let _ = read_line () in
  read_line () |> parse |> calc |> printf "%d\n"


Measured memory_bytes: 384
import java.util.*;
public class Main {

  public static void main(String[] args) { 
      Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[][] arr = new int[n][2];
      long sum = 0;
      for(int i = 0; i < n; i++) {
        arr[i][0] = sc.nextInt();
        arr[i][1] = sc.nextInt();
        sum += arr[i][1];
      }

      Arrays.sort(arr, (a, b) -> b[0] + b[1] - a[0] - a[1]);
      for(int i = 0; i < n; i+=2)
        sum -= (arr[i][0] + arr[i][1]);

      System.out.println(-sum);
  }
}

Measured memory_bytes: 94664
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout <<(#x)<<" is "<<(x)<<endl
#define debug cout <<"hi"<<endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MOD=1e9+7;
const int INF32=1<<30;
const ll INF64=1LL<<60;

void solve(){
  int n; cin >>n;
  cout <<"Christmas ";
  if(n<25) cout <<"Eve ";
  if(n<24) cout <<"Eve ";
  if(n<23) cout <<"Eve ";
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  solve();
return 0;}

Measured memory_bytes: 3504
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int h = s.nextInt(), w = s.nextInt(), n = s.nextInt();
		char[][] cs = new char[h][];
		for (int i = 0; i < h; ++i) {
			cs[i] = s.next().toCharArray();
		}
		int[][] p = new int[n + 1][];
		for (int i = 0; i < h; ++i) {
			for (int j = 0; j < w; ++j) {
				if (cs[i][j] == 'S') {
					p[0] = new int[] { i, j };
				} else if ('0' <= cs[i][j] && cs[i][j] <= '0' + n) {
					p[cs[i][j] - '0'] = new int[] { i, j };
				}
			}
		}
		int r = 0;
		for (int c = 1; c <= n; ++c) {
			boolean[][] cst = new boolean[h][w];
			Deque<int[]> q = new ArrayDeque<int[]>();
			q.add(new int[] { p[c - 1][0], p[c - 1][1], 0 });
			while (!q.isEmpty()) {
				int[] u = q.poll();
				if (u[0] == p[c][0] && u[1] == p[c][1]) {
					r += u[2];
					break;
				}
				cst[u[0]][u[1]] = true;
				int[] dx = { -1, 0, 0, 1 };
				int[] dy = { 0, -1, 1, 0 };
				for (int d = 0; d < 4; ++d) {
					int x = u[0] + dx[d], y = u[1] + dy[d];
					if (0 <= x && x < h && 0 <= y && y < w) {
						if (!cst[x][y] && cs[x][y] != 'X') {
							cst[x][y] = true;
							q.add(new int[] { x, y, u[2] + 1 });
						}
					}
				}
			}
		}
		System.out.println(r);
	}
}

Measured memory_bytes: 18000
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;
/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

int main(){
  string s;ll K;
  cin >> s >> K;
  for(int i=0;i<min((ll)s.size(),K);i++){
      if(s[i] >= '2') {
          cout << s[i] << endl; return 0;
      }
  }
  cout << '1' << endl;
  return 0;
}

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

#define int long long
#pragma GCC optimize ("O3")
#define ll long long
#define vi vector <int>
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define PI 3.14159265359


/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

using namespace __gnu_pbds;
typedef tree<pii,null_type,less <pii>,rb_tree_tag,tree_order_statistics_node_update>ind_set;
*/
///*X.find_by_order("index")
///X.order_of_key("key")



#define deb(x) cerr<<#x<< " : " <<x<<"\n";
#ifndef local
	#define deb(x) ;
#endif
///----------------------------------------------------------------------------------

int n,k;

void solve()
{cin>>n>>k;
	cout<<(k!=1?(n-k):0)<<"\n";

}

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);

    #ifdef local
    freopen("input.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    #endif

    clock_t qwertyuiop = clock();
    int t=1;
    ///cin>>t;
    rep(a,0,t)
    {
        ///cout<<"Case #"<<a+1<<": ";
        solve();
    }
    #ifdef local
	{qwertyuiop = clock() - qwertyuiop;double time_taken = ((double)qwertyuiop)/CLOCKS_PER_SEC;cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "<<time_taken<<" seconds\n";}
	#endif
}


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

using namespace std;

int main() {
    int N;
    vector<int> a;
    cin >> N;
    for (int i = 0; i < N; i++) {
        int num;
        cin >> num;
        a.push_back(num);
    }
    sort(a.begin(), a.end(), greater<int>());

    int sum1 = 0;
    int sum2 = 0;
    for (int i = 0; i < N; i++) {
        if (i % 2 == 0)sum1 += a[i];
        else sum2 += a[i];
    }
    cout << sum1 - sum2 << endl;

    return 0;
}

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

int max(int a, int b)
{
    return a >= b ? a : b;
}

int main()
{
    int N;
    scanf("%d", &N);
    int a[N][3], dp[N+1][3];
    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            scanf("%d", &a[i][j]);
        }
    }

    for (int i = 0; i < N+1; ++i) for (int j = 0; j < 3; ++j) dp[i][j] = 0;

    for (int i = 0; i < N; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            for (int k = 0; k < 3; ++k)
            {
                if (j != k)
                    dp[i+1][k] = max(dp[i+1][k], dp[i][j]+a[i][k]);
            }
        }
    }

    int ans;
    ans = max(dp[N][0], dp[N][1]);
    ans = max(ans, dp[N][2]);

    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 2560
// Problem : D - Restoring Road Network
// Contest : AtCoder - AtCoder Beginner Contest 074
// URL : https://atcoder.jp/contests/abc074/tasks/arc083_b
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define eb emplace_back
#define pb push_back
#define size(s) (int)s.size()
#define int long long
#define vi vector<int>
#define vs vector<string>
#define vv vector<vector<int>>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define inc(v,n,x) v.assign(n,x)
#define incd(v,n) v.resize(n)
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inimi(n) memset(n,0xc0,sizeof(n))
#define inima(n) memset(n,0x3f,sizeof(n))
#define all(v) (v).begin(),(v).end()

using namespace std;

template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }

const int N=200001;
double pi=acos(-1.0);
int md=1e9+7;
const int INF=1e15;
int dx1[]={0,0,-1,1};
int dy1[]={1,-1,0,0};

template<class T>
T abst(T a)
{return a<0?-a:a;}

template<class T>
T max2(T a,T b){return a>b?a:b;}
template<class T>
T min2(T a,T b){return a<b?a:b;}

void solve()
{
	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];
	}
	int total=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			int t=0;
			for(int k=0;k<n;k++)
			{
				if(k!=i and k!=j)
				{
					if(a[i][k]+a[k][j]<a[i][j])
					{
						cout<<-1;
						return;
					}
					else if(a[i][k]+a[k][j]==a[i][j])
					{
						t=1;
					}
				}
			}
			if(!t)
			total+=a[i][j];
		}
	}
	cout<<total;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)
{
    solve();
}
return 0;
}


Measured memory_bytes: 4304
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    int h,w; cin >> h >> w;
    vector<vector<char>> table(h,vector<char>(w));
    rep(i,h)rep(j,w) cin >> table.at(i).at(j);
    vector<vl> dp(h,vl(w,0));
    rep(i,w){
        if(table.at(0).at(i) == '#') break;
        dp.at(0).at(i) = 1;
    } 
    rep(i,h){
        if(table.at(i).at(0) == '#') break;
        dp.at(i).at(0) = 1;
    }
    for(int i = 1; i < h; i++){
        for(int j = 1; j < w; j++){
            if(table.at(i).at(j) == '#') continue;
            dp.at(i).at(j) = (dp.at(i-1).at(j) + dp.at(i).at(j-1))%mod;
        }
    }
    cout << dp.at(h-1).at(w-1) << endl;
    return 0;   

}


Measured memory_bytes: 9088
def readinput():
    n=int(input())
    d=[]
    for i in range(n):
        d.append(int(input()))
    return (n,d)

def main(n,d):
    d.sort(reverse=True)
    npre=d[0]
    ndan=1
    for i in range(1,n):
        if(d[i]<npre):
            npre=d[i]
            ndan+=1
    
    return ndan

def main2(n,d):
    # 別解
    set_d = set(d)
    return len(set_d)

if __name__=='__main__':
    n,d=readinput()
    ans=main2(n,d)
    print(ans)


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

int main() {

  int N;
  cin >> N;

  vector<int> A(N);

  int min = 1000000000;
  long total = 0;
  for(int i = 0; i < N; i++){
    cin >> A[i];
    if(A[i] < min){
      min = A[i];
    }
    total += A[i];
  }

  sort(A.begin(), A.end(), greater<int>());
  long long ans = A[0];
  int j = 1;
  for(int i = N - 2; i > 0; i = i - 2){
    if(i >= 2){
      ans += A[j] * 2;
      j++;
    }else{
      ans += A[j];
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4032
#include<iostream>
#include<climits>
#include<vector>
#include<list>
#include<functional>
#include<algorithm>
#include<string>
#include<cmath>
#include<complex>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<tuple>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define INF (int)1e9
#define INFL (ll)1e11
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

void dfs(int i, vector<vector<int>> a, vector<int> &d, vector<int> &f) {
	int n = a.size();
	int next = -1;
	REP(j, n) {
		if (d[j] == 0 && a[i][j]) {
			if (next == -1) d[j] = d[i] + 1;
			else d[j] = f[next] + 1;
			next = j;
			dfs(j, a, d, f);
		}
	}
	if (next == -1) f[i] = d[i] + 1;
	else f[i] = f[next] + 1;
}

void dfs_all(vector<vector<int>> a, vector<int> &d, vector<int> &f) {
	int i = 0;
	int n = a.size();
	int end = -1;
	while (1) {
		if (end == -1) d[0] = 1;
		else {
			while (d[i] > 0) i++;
			if (i == n) return;
			d[i] = f[end] + 1;
		}
		end = i;
		dfs(i, a, d, f);
	}
}

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

	int n;
	cin >> n;
	vector<vector<int>> a(n, vector<int>(n, 0));
	REP(i, n) {
		int u, k;
		cin >> u >> k;
		u--;
		REP(j, k) {
			int v;
			cin >> v;
			a[u][--v] = 1;
		}
	}
	vector<int> d(n + 1, 0);
	d[0] = 1;
	vector<int> f(n);
	dfs_all(a, d, f);
	
	REP(i, n) {
		cout << i + 1 << " " << d[i] << " " << f[i] << "\n";
	}

	return 0;
}




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

int main(int argc, char const* argv[])
{
	int debt = 100000;
	int n;
	cin >> n;

	for (int i = 0; i < n; ++i) {
		debt *= 1.05;
		debt += debt % 1000 != 0? 1000 : 0;
		debt -= debt % 1000;
	}
	cout << debt << endl;

	return 0;
}

Measured memory_bytes: 0
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt() - 1;
		}
		
		int count = 0;
		for (int i = 0; i < n; i++) {
			if (a[a[i]] == i) {
				count++;
			}
		}
		
		out.println(count / 2);
		out.flush();
	}
	
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;
	
	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}
	
	private byte readByte() {
		if (hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}
	
	private boolean isPrintableChar(int c) {
		return '!' <= c && c <= '~';
	}
	
	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}
	
	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}
	
	public int nextInt() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
	
}

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

int main() {
	long long N,ans;
	cin >> N;
	if (N % 2 == 0) {
		N = N / 10;
		ans = N;
		while (N> 0) {
			N= N / 5;
			ans += N;
		}
	}
	cout<< ans <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<stack>
#include<string.h>
#include<queue>
#include<ctype.h>
#include<map>
#include<string>
using namespace std;
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    char ch[102][102];
    string str[102];
    for(int i=0;i<a;i++){
        scanf("%s",ch[i]);
        str[i]=ch[i];
    }
    sort(str,str+a);
    for(int i=0;i<a;i++){
        cout<<str[i];
    }
    cout<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/


int main() {
    int N, K;
    cin >> N >> K;
    cout << (N + K - 3) / (K - 1) << endl;
    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 REP(i,k,n) for(int i = k; i < (int)(n); i++)
typedef long long ll;
#define pb push_back

// dp問題

int main(){
        int N,A;
        int x;
        int y[50];
        int absMax = 0;

        cin >> N >> A;
        rep(i,N){
                cin >> x;
                y[i] = x - A;
        }
        rep(i,N){
                if(absMax < abs(y[i])) absMax = abs(y[i]);
        }
        int yMax = N * absMax;

        // -YM ~ 0 ~ YM
        // 0以上で表現できるように 0 ~ 2YMに置き換えて考える
        ll dp[N+1][2*yMax+1];

        rep(i,2*yMax+1) dp[0][i]=0;
        dp[0][yMax]=1;

        for(int i = 1; i < N+1; i++) {
                rep(sum,2*yMax+1){
                        if(sum - y[i-1] < 0 || 2 * yMax < sum - y[i-1] ) {
                                dp[i][sum] = dp[i-1][sum];
                        }else{
                                dp[i][sum] = dp[i-1][sum] + dp[i-1][sum - y[i-1]];
                        }
                }
        }

        // 0枚しか選ばない時を除外する
        cout << dp[N][yMax] - 1 << endl;

        return 0;
}


Measured memory_bytes: 2176
import java.util.Scanner;

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

		int n = sc.nextInt();

		int max = 0;

		int sum = 0;

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

			int l = sc.nextInt();

			if (l > max) {
				max = l;
			}

			sum += l;

		}

		sum -= max;

		if (sum <= max) {

			System.out.println("No");

		} else {

			System.out.println("Yes");
		}


		sc.close();
	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;

template <int mod>
struct ModInt
{
    int x;

    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p)
    {
        if ((x += p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator-=(const ModInt &p)
    {
        if ((x += mod - p.x) >= mod)
            x -= mod;
        return *this;
    }
    ModInt &operator*=(const ModInt &p)
    {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }
    ModInt &operator/=(const ModInt &p)
    {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const
    {
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0)
        {
            t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }

    ModInt pow(int e)
    {
        long long a = 1, p = x;
        while (e > 0)
        {
            if (e % 2 == 0)
            {
                p = (p * p) % mod;
                e /= 2;
            }
            else
            {
                a = (a * p) % mod;
                e--;
            }
        }
        return ModInt(a);
    }

    friend ostream &operator<<(ostream &os, const ModInt<mod> &p)
    {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a)
    {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

using modint = ModInt<mod>;
modint f[d5];

void makef()
{
    f[0] = 1;
    for (int i = 1; i < d5; i++)
        f[i] = f[i - 1] * i;
}

modint nCr(int n, int r)
{
    if (n < r || r < 0)
        return 0;
    return f[n] / (f[r] * f[n - r]);
}
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    makef();
    int a, b;
    cin>>a>>b;
    if(abs(a-b)>1){
        cout << 0 << endl;
    }
    else{
        modint res = 1;
        res *= f[min(a,b)];
        res *= f[max(a,b)];
        if(a==b)
            res *= 2;
        cout << res << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int H, N;
  cin >> H >> N;
  vector<int> vec(N);
  string answer = "No";
  for(int i = 0; i < N; i++){
    cin >> vec.at(i);
  }
  if(H <= accumulate(vec.begin(), vec.end(), 0)){
    answer = "Yes";
  }
  cout << answer << endl;
return 0;
}

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

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;

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

template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==v.size()?"":" ");
    return os;
}


signed main(){
    int n;cin>>n;
    vector<vector<int>> g(n);
    rep(i,n-1){
        int u,v;cin>>u>>v;u--,v--;
        g[u].push_back(v);
        g[v].push_back(u);
    }

    vector<int> c(n,-1);
    function<void(int,int)> dfs=[&](int pre,int now){
        int b=0;
        for(auto to:g[now])if(pre!=to){
            dfs(now,to);
            if(c[to]==0) b++;
        }

        if(b) c[now]=1;
        else c[now]=0;
    };dfs(-1,0);

    int b=0;
    rep(i,n)if(c[i]==0)b++;
    int w=n-b;
    if(b>w)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
    return 0;
}


Measured memory_bytes: 9196
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main
{
    public static void main(String[] args)
    {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB
    {
        public void solve(int testNumber, Scanner in, PrintWriter out)
        {
            int T = 1;
            while (T-- > 0)
            {
                solveOne(in, out);
            }
        }

        private void solveOne(Scanner in, PrintWriter out)
        {
            String S = in.next();
            long sum = 0;
            for (char c : S.toCharArray())
            {
                sum += (c - '0');
            }
            out.print(sum % 9 == 0 ? "Yes" : "No");
        }

    }
}



Measured memory_bytes: 31800
#include<iostream>
#include<functional>
#include<algorithm>
#include<stack>
#include<string>
#include<vector>

using namespace std;

#define LL long long

stack<int> st;
string s;

vector<string> vs;
void split(string s, char c){
	int fr=0;
	for(int i=0;i<s.size();i++){
		if(s[i]==c){
			vs.push_back(s.substr(fr,i-fr));
			fr=i+1;
		}
	}
	if(fr!=s.size())vs.push_back(s.substr(fr,s.size()-fr));
	return;
}

int main() {
	getline(cin,s);
	split(s,' ');
	for(int i=0;i<vs.size();i++){
		if (vs[i] == "+") {
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(b + a);
		}
		else if (vs[i] == "-") {
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(b - a);
		}
		else if (vs[i] == "*") {
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(b * a);
		}
		else{
			st.push(stoi(vs[i]));
		}
	}

	cout<<st.top()<<endl; 

	return 0;
}




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

typedef long long ll;





int main() {
    ios_base::sync_with_stdio(false), cin.tie(nullptr);
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    for(char c : s){
        if(c == 'R')cnt++;
        else cnt = 0;
        ans = max(cnt, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
#define all(x) (x).begin(), (x).end()
#define fsp(x) fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = acos(-1);
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//二分探索
//main関数で呼び出す前に，l, rの一方が条件を満たし他方が満たさないことを確認すること
//配列を引数にするときは原則として参照渡しすること
long long bs1(long long l, long long r, ll n, vll &a, ll b) {
	//解近傍の処理
	//if (l == r) return l;
	if (l + 1 == r) {
		if (a[r] < b) return r + 1;
		else return r;
	}

	//再帰
	long long mid = (l + r) / 2;
	if (a[mid] < b) return bs1(mid, r, n, a, b);
	else return bs1(l, mid, n, a, b);
}

//二分探索
//main関数で呼び出す前に，l, rの一方が条件を満たし他方が満たさないことを確認すること
//配列を引数にするときは原則として参照渡しすること
long long bs2(long long l, long long r, ll n, vll &c, ll b) {
	//解近傍の処理
	//if (l == r) return l;
	if (l + 1 == r) {
		if (c[l] > b) return n - l;
		else return n - r;
	}

	//再帰
	long long mid = (l + r) / 2;
	if (c[mid] > b) return bs2(l, mid, n, c, b);
	else return bs2(mid, r, n, c, b);
}

int main() {
	//ios::sync_with_stdio(false);
	//cin.tie(nullptr);
	//const ll p = 1e9 + 7;
	//const ll p = 998244353;

	ll n;
	cin >> n;
	vll a(n), b(n), c(n);
	for (ll i = 0; i < n; i++) cin >> a[i];
	for (ll i = 0; i < n; i++) cin >> b[i];
	for (ll i = 0; i < n; i++) cin >> c[i];
	sort(all(a));
	sort(all(c));

	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		if (a[0] >= b[i] || c[n - 1] <= b[i]) continue;
		ll x, y;
		if (a[n - 1] < b[i]) x = n;
		else x = bs1(0, n - 1, n, a, b[i]);
		if (c[0] > b[i]) y = n;
		else y = bs2(0, n - 1, n, c, b[i]);
		ans += x * y;
	}
	cout << ans << endl;
}


Measured memory_bytes: 2560
N=int(input())

x=int(N/1.08)
if ((x-1)*1.08)//1==N:
  print(x-1)
elif (x*1.08)//1==N:
  print(x)
elif ((x+1)*1.08)//1==N:
  print(x+1)
else:
  print(":(")

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x)  cerr<< #x <<" = "<< x<<endl;
using namespace std;

typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
map<int,int>cnt;
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		int x;
		scanf("%d",&x);
		cnt[x]++;
	}int last=-1;
	ll ans=0;
	tr(it,cnt){
		if(it->ss>=4)
			umax(ans,it->ff*1LL*it->ff);
		if(it->ss>=2){
			if(~last)
				umax(ans,it->ff*1LL*last);
			last=it->ff;	
		}
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main(){
  int N,ans=0;
  cin>>N;
  int a[2*N];
  for(int i=0;i<2*N;i++) cin>>a[i];
  sort(a,a+2*N);
  for(int i=0;i<2*N;i+=2) ans+=a[i];
  cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <limits.h>
#include <math.h>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>

#define repeat(i,n) for (long long i = 0; (i) < (n); ++ (i))
#define debug(x) cerr << #x << ": " << x << '\n'
#define debugArray(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i] << '\n'
#define debugArrayP(x,n) for(long long i = 0; (i) < (n); ++ (i)) cerr << #x << "[" << i << "]: " << x[i].first<< " " << x[i].second << '\n'

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef vector<int> vint;
typedef vector<ll> vll;
const ll INF = INT_MAX;
const ll MOD = 1e9+7;

ll modpow(ll x,ll n){
  if(n==0)return 1;
  ll ret=modpow(x*x%MOD,n/2);
  if(n&1)ret = ret*x%MOD;
  return ret;
}

int main(){
  int N;cin>>N;
  vint A(N);
  repeat(i,N){
    cin>>A[i];
  }
  sort(A.begin(),A.end(),greater<int>());
  bool isok = true;
  //debugArray(A,N);
  repeat(i,N/2){
    isok &= A[2*i]==N-(2*i+1);
    isok &= A[2*i+1]==N-(2*i+1);
  }
  if(N&1){
    isok &= A.back()==0;
  }
  cout << (isok? modpow(2,N/2):0)<<endl;
  return 0;
}


Measured memory_bytes: 640
#include<stdio.h>
int main(void){
  int n, k, i, j;
  double s=0, p[210000], q[210000]={};
  
  scanf("%d %d",&n, &k);
    for(i=0; i<n; i++){
      scanf("%lf", &p[i]);
      p[i]=(p[i]+1)/2;
      
    }
  
  for(i=0; i<k; i++){
      q[0]+=p[i];
    s=q[0];
  }
  for(i=1; i<n-k+1; i++){
    q[i]=q[i-1]-p[i-1]+p[i+k-1];
    if(s<q[i]){
      s=q[i];
    }
  }
  printf("%lf\n",s);
  return 0;
}


Measured memory_bytes: 3456
#pragma once

#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;
string S[2],H,D;


int main() {
	
	H = "H";
	D = "D";

	cin >> S[0];
	cin >> S[1];

	if (S[0]==H) {
		if (S[1] == H) {
			cout << H.c_str() << endl;
		}
		else {
			cout << D.c_str() << endl;
		}
	}
	else {
		if (S[1] == H) {
			cout << D.c_str() << endl;
		}
		else {
			cout << H.c_str() << endl;
		}

	}


	return 0;
}




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

using namespace std;

int main() {
	
	int n;
	vector<int> a;
	int tmp;
	int ans = 0;

	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> tmp;
		a.push_back(tmp);
	}

	int j;
	for (int i = 0; i < a.size(); ++i) {
		j = a[i];
		if (a[j - 1] == i + 1) {
			++ans;
		}
	}
	cout << ans / 2 << endl;
}


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

#define ll long long
#define MOD 1000000007
#define LLMN LONG_LONG_MIN
#define LLMX LONG_LONG_MAX
#define MAX 1000000

vector<bool>prime(MAX, true);
vector<ll>fact(MAX);
vector<ll>factinv(MAX);

ll  fastpower(ll a, ll n)
{
    ll res = 1;
    while(n > 0)
    {
        if(n % 2 != 0)
        {
            res = (res * a) % MOD;
        }
        n /= 2;
        a=(a * a) % MOD;
    }
    return res;
}

void getprime()
{
    for(ll i = 2;i < MAX; i++)
    {
        if(prime[i-1])
        {
            for(ll j = i*i; j < MAX; j += i)
                prime[j-1] = false;
        }
    }
}

void getfact()
{
    fact[0] = 1;
    factinv[0] = 1;
    
    for(ll i = 1; i < MAX; i++)
        fact[i] = (fact[i-1] * i)%MOD;
    
    for(ll i = 1; i < MAX; i++)
        factinv[i] = (factinv[i-1] * fastpower(i, MOD -2) )%MOD;

}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t,n,m,q;
    cin>>n>>m;
    vector<ll>h(n);
    for(ll i=0;i<n;i++) cin>>h[i];
    vector<ll>adj(n,LLMN);
    while(m--)
    {
        ll x,y;
        cin>>x>>y;
        adj[x-1]=max(adj[x-1], h[y-1]);
        adj[y-1]=max(adj[y-1], h[x-1]);
        

    }
    ll res=0;
    for(ll i=0;i<n;i++)
    {
        if(h[i] > adj[i])
            res++;
    }
    cout<<res;
    return 0;
}

Measured memory_bytes: 20596
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
#include <tuple>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define rep1(i,a) for(int i=1; i<=a; i++)
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define mem(a,n) memset( a, n, sizeof(a))
#define all(a) a.begin(),a.end()

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> V;
typedef vector<V> VV;
typedef vector<VV> VVV;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;
static const double pi = 3.141592653589793;

ll fact[200000], invFact[200000]; 

long long power(long long x, long long c) {
    if(c==0) return 1;
    if(c==1) return x;
    if (c%2==1) return (power( (x*x)%MOD, c/2)*x)%MOD;
    else return power( (x*x)%MOD, c/2)%MOD;
}

void make_combT(ll n){
    fact[0]=1;
    rep1(i,n) fact[i]= fact[i-1]*i%MOD;
    
    invFact[n] = power(fact[n],MOD-2);
    rrep(i,n-1) invFact[i] = invFact[i+1] * (i+1) %MOD;
}

ll comb(ll n, ll m){
    if(n<m||n<0||m<0) return 0;
    return (fact[n] * invFact[m] %MOD) * invFact[n-m] %MOD;
}

ll hcomb(ll n, ll m){
    if(n==0&&m==0) return 1;
    return comb(n+m-1,m);
}

int visit[100009];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int N;
    cin>>N;
    N++;
    int l,r;
    rep1(i,N){
        int x; cin>>x;
        if(visit[x]){
            l = visit[x];
            r = i;
        }else{
            visit[x]=i;
        }
    }
    
    make_combT(200000);
    int len = N - (r-l+1);
    rep1(k,N){
        ll c = comb(N,k);
        ll a = comb(len,k-1);
        c = (MOD+c-a)%MOD;
        cout1(c);
    }
}

Measured memory_bytes: 4736
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <bitset>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    ll a, b;
    cin >> a >> b;
    ll ans = 0;

    if(a % 2 == 1) {
        ans ^= a;
        a++;
    }
    if(b % 2 == 0) {
        ans ^= b;
        b--;
    }
    if((b-a+1)/2 % 2 == 1) ans ^= 1;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const ll mod=1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

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

    int a, b; cin >> a >> b;
    if(a > b) swap(a, b);

    int d = b - a;
    if(d % 2){
        cout << "IMPOSSIBLE" << endl;
    }
    else {
        cout << a + d/2 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define max(a, b)	(((a) > (b)) ? (a) : (b))		/* ２個の値の最大値 */
#define min(a, b)	(((a) < (b)) ? (a) : (b))		/* ２個の値の最小値 */
#define ENTER		printf("\n")					/* 改行プリント */
int DBG = 0;										/* デバッグプリント 提出時は0 */
/* main *************************************************************/
int		s[100001] = { 0 };
	
int main()
{
	int		a,c,i,j,k,q,n,m,x,y,ans = 0;

	
	scanf("%d", &n);
	for(i=1;i<=n;i++) {
		scanf("%d", &a);
		s[a] = i;
	}
	
	for(i=1;i<n;i++) {
		printf("%d ",s[i]);
	}
	printf("%d\n",s[n]);


	return 0;
}


Measured memory_bytes: 1152
/*** akshaykumar99 ***/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;

const long long MOD = 1e9+7;
const long double PI = acos(-1);
const long long N = 1e5+1;
 
typedef long long ll;
typedef long double ld;

void test_case()
{   
   	ll n, k;
   	cin >> n >> k;
   	vector<ll> v(n);
   	ll s = 0;
   	for(int i = 0; i < n; i++)
   	{
   		cin >> v[i];
   		s+= v[i];
   	}
   	if(s <= k)
   	{
   		cout << 1 << '\n';
   		return;
   	}
   	ll lf = 1, rt = 1e9;
   	ll ans = rt;
   	while(lf < rt)
   	{
   		ll mid = (lf + rt) >> 1;
   		ll tot = 0;
   		for(int i = 0; i < n; i++)
   		{
   			ll xx = v[i]/mid;
   			if(v[i] % mid != 0)
   				xx++;
   			tot += xx - 1;
   		}
   		if(tot <= k)
   		{
   			ans = mid;
   			rt = mid;
   		}
   		else 
   			lf = mid + 1;
   	}
   	cout << ans << ' ';

}
 
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL); 
    ll tc=1;
    // cin>>tc;
    while(tc--)
        test_case();
    return 0;
}

Measured memory_bytes: 4728
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double r = sc.nextDouble();
        double a = r*r*3.141592653589;
        double b = 2*r*3.141592653589;
        System.out.println (String.format("%.5f", a) + " " + String.format("%.5f", b));
      }
    }



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

int main() {
    int N;
    int count =1;
    cin >>N;
    if(N==1) {
        cout << 1 <<endl;
        return 0;
    }
    vector<int> data(N);
    for (int i=0; i<N;i++){
        cin >> data.at(i);
    }
    if(data.at(0)<=data.at(1)) count =2;
    int s = data.at(0);
    for(int i=1; i<N-1;i++){
        if(s<data.at(i)){
            s=data.at(i);
        }
        if(s<=data.at(i+1)) count++;   
}
cout << count <<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <utility>
#include <iomanip>

using namespace std;

#define ll long long

void solve()
{
    vector<ll> t(3);
    cin >> t.at(0) >> t.at(1) >> t.at(2);
    sort(t.begin(), t.end());
    cout << t.at(0) + t.at(1) << endl;

    return;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	var Input = input.split("\n");
	
  	var str = Input[0];
  	var n = Number(Input[1])
    
    var arr = str.split("")
    var cnt = 1
    var cntArr = []
    
    for(var i in arr){
      
      if(arr[i] == arr[parseInt(i,10) + 1]){
        cnt = cnt + 1
      }else{
        cntArr.push(cnt)
        cnt = 1
      }
    }
  
  	var ans = 0
  	
  	var len = arr.length
    var cntlen = cntArr.length
    
    var a =0
    var b = 0
    var c =0
    
    if(cntlen == 1){
  
       ans = Math.floor( cntArr[0] * n / 2 )
       
    }else if(arr[0] == arr[len -1]){
    
      for(var j in cntArr){
        
        if(j == 0){
        	var a = Math.floor( cntArr[j] / 2 )
        }else if(j == cntlen - 1){
        	var b = Math.floor( ( cntArr[0] + cntArr[j] ) /2 )
            var c = Math.floor( cntArr[j] / 2 )
        }else{
	        ans = ans + Math.floor( cntArr[j] / 2 )
        } 
      }
    
      ans = ans * n + b * (n -1) + a + c
      
    }else{
      for(var j in cntArr){
        ans = ans + Math.floor( cntArr[j] / 2 )
      }
      ans = ans * n
    }
  
	//出力
	console.log(ans);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

using str = string;
using ss = stringstream;

using ll = long long;

#define fi first
#define se second

int nPr(int in, int ir)
{
    if(in<ir)return 0;
    int ret=1;
    for(int i=in;i>=ir+1;i--)ret*=i;
    return ret;
}

ll nCr(ll in, ll ir)
{
    if(in<ir)return 0;
    ll a=1,b=1;
    for(;ir>=1;ir--,in--){a*=in;b*=ir;}
    ll ret=a/b;
    return ret;
}

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

    int n;cin>>n;
    vector<int[26]> s(n);

    map<str,int> m;

    for(int i=0;i<n;i++)
    {
        str is;cin>>is;
        for(int j=0;j<is.size();j++)s[i][is[j]-'a']++;

        ss makefi;
        for(int j=0;j<26;j++)makefi<<char(s[i][j]+'0');
        m[makefi.str()]++;
    }

    ll ans=0;

    for(auto mm:m)
    {
        if(mm.se>=2)
        {
            ans+=nCr(mm.se,2);
        }
    }

    cout<<ans<<"\n";

    return 0;
}


Measured memory_bytes: 25940
#include <bits/stdc++.h>
#define typeof(x) __typeof__(x)
#define int long long int
#define double long double
#define mod(x) ((x % MOD) + MOD) % MOD
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);--i)

#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SZ(c) (int)((c).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define LB(c,x) (int)(lower_bound(ALL(c),x)-(c).begin())
#define UB(c,x) (int)(upper_bound(ALL(c),x)-(c).begin())
#define COUNT(c,x) UB(c,x)-LB(c,x)
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (s).find(e)!=(s).end()
#define PB push_back
#define MP make_pair
#define vec vector

#define dump(x)  cerr << #x << " = " << (x) << endl;

using namespace std;

typedef pair<int,int> P;
struct edge { int to, cost; };

const int INF = 1e18;
const int MOD = 1e9+7;

template<typename T> ostream& operator << (ostream& s, const vector<T>& v) {
   s << "[";
   for (int i = 0; i < v.size(); i++) { s << v[i]; if (i < v.size() - 1) s << " "; }
   s << "]";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const pair<T1,T2>& p) {
   s << "(" << p.first << "," << p.second << ")";
   return s;
}
template<typename T1, typename T2> ostream& operator << (ostream& s, const map<T1,T2>& m) {
   s << "{";
   for (auto i = m.begin(); i != m.end(); ++i) {
      s << i->first << ":" << i->second;
      if (next(i) != m.end()) s << ", ";
   }
   s << "}";
   return s;
}

signed main()
{
   string s; cin >> s;
   int MIN = INF;
   rep(i, 0, SZ(s)-2) {
      int num = 100*(s[i]-'0') + 10*(s[i+1]-'0') + s[i+2]-'0';
      MIN = min(MIN, max(753-num, num-753));
   }
   cout << MIN << endl;
   return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int A,B,M; cin >> A >> B >> M;
    vector<ll> a(A),b(B);
    rep(i,A) cin >> a[i];
    rep(i,B) cin >> b[i];
    ll ans=INF;
    rep(i,M){
        int x,y; ll c; cin >> x >> y >> c;
        chmin(ans,a[--x]+b[--y]-c);
    }
    sort(all(a)); sort(all(b));
    cout << min(ans,a[0]+b[0]) << '\n';
}

Measured memory_bytes: 1792
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//typedef pair<ll,ll> A;
//vector<A> pc;
//int ABS(int a){return max(a,-a);}
int main() {
  ll n;
  cin>>n;
  ll A[n];
  ll ans=0;
  ll mi=0;
  ll on=1000000001,tmp;
  for(int i=0;i<n;i++){
    cin>>A[i];
    tmp=A[i];
    if(A[i]<0) mi++;
    if(on>abs(tmp)) on=abs(tmp);
  }
  for(int i=0;i<n;i++) ans+=abs(A[i]);
  if(mi%2)ans-=abs(on)*2;
  cout<<ans;
  return 0;
}

Measured memory_bytes: 1024
n,m=map(int,input().split())
ab=[]
for _ in range(m):
  ab.append(list(map(int,input().split())))
c1x=set([x[1] for x in ab if x[0]==1])
cxn=set([x[0] for x in ab if x[1]==n])
print('POSSIBLE'if len(c1x & cxn)>0 else 'IMPOSSIBLE')


Measured memory_bytes: 60296