akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <numeric>
#include <iomanip>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)(n);++i)
#define rep1(i, n) for (int i=1;i<=(int)(n);++i)
#define rrep(i, n) for (int i=(int)(n)-1;i>=0;--i)
#define rrep1(i, n) for (int i=(int)(n);i>=1;--i)
#define range(i, l, r) for (int i=l;i<(int)(r);++i)
#define rrange(i, l, r) for (int i=(int)(r)-1;i>=l;--i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using vi=vector<int>;
using pii=pair<int, int>;
using vpii=vector<pii>;
using ll=long long;

constexpr int TEN(int n){return n==0?1:10*TEN(n-1);}
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
int read(){int a;scanf("%lld",&a);return a;}

signed main()
{
	int n; cin >> n;
	int kosuu = n / 2 + n%2;
	double ans = (double)kosuu / n;
	printf("%.10f\n", ans);
}




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

int main(){
  int W,n;
  cin>>W;
  int num[W+1];
  for(int i=1;i<=W;i++){
    num[i]=i;
  }
  cin>>n;
  int change1=0,change2=0;
  int alt=0;
  for(int i=0;i<n;i++){
    scanf("%d,%d",&change1,&change2);
    alt=num[change1];
    num[change1]=num[change2];
    num[change2]=alt;
  }
  for(int i=1;i<W+1;i++){
    cout<<num[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include <iostream>

using namespace std;
int a, b, c, d, ans = 0;
int main() {
    cin >> a >> b >> c >>d;
    if (a <= b)
        ans += a;
    else
        ans += b;
    if (c <= d)
        ans += c;
    else
        ans += d;
	cout<< ans <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=2e5;
const int INF=1e9;
int main(){
	int N;string s;cin>>N>>s;
	vector<deque<int>> g(N);
	rep(i,0,N)rep(j,i+1,N){
		if(s[i]==s[j]) g[i].push_back(j-i);
	}
	int dp[N][5000]={};int ans=0;
	for(int j:g[0]) dp[0][j]=1;
	rep(i,1,N)for(int j:g[i]){
		if(s[i-1]==s[i-1+j]){
            if(dp[i-1][j]>=j) continue;
            else dp[i][j]=dp[i-1][j]+1;
        }else dp[i][j]=1;
		ans=max(ans,dp[i][j]);
	}cout<<ans<<endl;
    //pprint(dp,N,10);
}

Measured memory_bytes: 152064
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

int a[505][505];

void go(int l,int r,int used=1)
{
	if(l==r)return;
	int mid=(l+r)/2;
	rep(i,l,mid)rep(j,mid+1,r)a[i][j]=used;
	go(l,mid,used+1);
	go(mid+1,r,used+1);
}

int main()
{ios_base::sync_with_stdio(false);
int n;
cin>>n;
go(1,n);
rep(i,1,n-1)
{
	rep(j,i+1,n)
	{
		ol(a[i][j]);os;
	}
	on;
}
return 0;
}



Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n, m, ans = 0;
  cin >> n >> m;
  vector<int> v(n);
  vector<vector<bool>> graph(n, vector<bool> (n,0));
  for(int i=0; i<n; i++) v[i] = i;
  for(int i=0; i<m; i++){
    int a, b;
    cin >> a >> b;
    graph[--a][--b] = true;
    graph[b][a] = true;
  }
  do{
    bool flag = true;
    for(int i=1; i<n; i++) if(graph[v[i-1]][v[i]] == false) flag = false;
    ans += flag;
  }while(next_permutation(v.begin() + 1, v.end()));
  cout << ans << endl;
}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
typedef pair<ll, int> P;
struct BIT {
	vector<ll> bit;
	int n;
	BIT(int n) :n(n) {
		bit = vector<ll>(n + 1, 0);
	}
	ll sum(int i) {
		i++;
		ll s = 0;
		while (i > 0) {
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}
	ll get(int i) {
		ll ret = sum(i);
		if (i > 0) ret -= sum(i - 1);
		return ret;
	}
	void add(int i, ll x) {
		i++;
		while (i <= n) {
			bit[i] += x;
			i += i & -i;
		}
	}
};
int main() {
	int N;
	ll K;
	cin >> N >> K;
	vector<ll> sum(N + 1);
	sum[0] = 0;
	for (int i = 1; i <= N; i++) {
		ll a;
		cin >> a;
		sum[i] = sum[i - 1] + a - K;
	}
	vector<P> vec;
	for (int i = 0; i <= N; i++) vec.emplace_back(sum[i], i);
	sort(vec.begin(), vec.end());
	BIT bit(N + 1);
	ll ans = 0;
	for (int i = 0; i <= N; i++) {
		ans += bit.sum(vec[i].second);
		bit.add(vec[i].second, 1);
	}
	cout << ans << endl;
 }

Measured memory_bytes: 8048
#include <bits/stdc++.h>
using namespace std;
#define PII pair<int, int>
#define VI vector<int>
#define VPII vector<PII>
#define LL long long
#define LD long double
#define f first
#define s second
#define MP make_pair
#define PB push_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
#define SIZ(c) (int)(c).size()
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, b, e) for(int i = (b); i <= (int)(e); ++i)
#define FORD(i, b, e) for(int i = (b); i >= (int)(e); --i)

#define sim template<class n
sim, class s> ostream & operator << (ostream &p, pair<n, s> x)
{return p << "<" << x.f << ", " << x.s << ">";}
sim> auto operator << (ostream &p, n y) ->
typename enable_if<!is_same<n, string>::value, decltype(y.begin(), p)>::type 
{int o = 0; p << "{"; for(auto c: y) {if(o++) p << ", "; p << c;} return p << "}";}
void dor() {cerr << endl;}
sim, class...s> void dor(n p, s...y) {cerr << p << " "; dor(y...);}
sim, class s> void mini(n &p, s y) {if(p>y) p = y;}
sim, class s> void maxi(n &p, s y) {if(p<y) p = y;}
#ifdef DEB
#define debug(...) dor(__FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__)
#else
#define debug(...)
#endif 

#define I(x) #x " =", (x), " "
#define A(a, i) #a "[" #i " =", i, "] =", a[i], " "


int main()
{
  VI V = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << V[k-1] << endl;
}


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


int main() {
  int X,A,B;cin >> X >> A >> B;
  if (A >= B){
    cout << "delicious" << endl;
  }else if(X >= B-A){
    cout << "safe" << endl;
  }else{
    cout << "dangerous" << endl;
  }

}       

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();

        int count = 0;
        for (int i = 0 ; i < s.length ; i++) {
            if (i % 2 == 0) {
                if (s[i] == '0') {
                    count++;
                }
            } else {
                if (s[i] == '1') {
                    count++;
                }
            }
        }
        int count2 = 0;
        for (int i = 0 ; i < s.length ; i++) {
            if (i % 2 == 1) {
                if (s[i] == '0') {
                    count2++;
                }
            } else {
                if (s[i] == '1') {
                    count2++;
                }
            }
        }
        System.out.println(Math.min(count, count2));
    }

}


Measured memory_bytes: 25960
a,b,c,x,y=map(int, input().split())
answer=[]
for i in range(max(x,y)*2+1):
    answer.append((x-i//2)*a+(y-i//2)*b+i*c)
    if x-i//2<0:
        answer[i]=answer[i]-(x-i//2)*a
    if y-i//2<0:
        answer[i]=answer[i]-(y-i//2)*b
print(min(answer))

Measured memory_bytes: 11032
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    string s;
    cin >> s;
    ll answer = 0;
    REP(i,4){
        if(s[i] == '2')answer++;
    }
    cout << answer << endl;
    
    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
 
using namespace std;
typedef long long ll;
 
int main() {
  string S;
  cin >> S;
  bool C = false;
  for (int i = 0; i < S.size(); i++) {
    if (S[i] == 'C') {
      C = true;
    }
    if (C && S[i] == 'F') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
K, N = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = 0
del_A = []
for i in range(N):
  if(i==(N-1)):
    del_A.append(A[0]+K-A[i])
  else:
    del_A.append(A[i+1]-A[i])
print(sum(del_A)-max(del_A))

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

#define 	ll 						long long int
#define 	pb 						push_back
#define 	mp 						make_pair
#define 	fast 					ios_base::sync_with_stdio(false);cin.tie(NULL);
#define 	ff 						first
#define 	ss 						second
#define 	nil 					-10e+9
#define 	initial 				0
#define 	waiting 				1
#define 	visit 					2
#define 	inf  					10e+9
#define 	mx   					200005
#define 	mxx  					1000005
#define 	mod  					1000000007
#define 	pr   					pair<ll,ll>
#define 	pp_queue 			priority_queue<pr,vector<pr>, greater<pr> >
#define 	dp_queue 			priority_queue<int,vector<int>, greater<int> >
#define 	sp_queue 			priority_queue<int>
#define 	fr(i,p,q)			for(int i=p;i<q;++i)
#define 	frr(i,p,q) 		for(int i=p;i<=q;++i)
#define 	mem(a,b) 			memset(a,b,sizeof(a))
#define 	len(a)   			(int)a.size()
#define 	input  				freopen("input.txt", "r", stdin);
#define 	output 				freopen("output.txt", "w", stdout);
#define 	debug(arr,j,n) fr(i,j,n) cout<<arr[i]<<" ";

ll power(ll a,ll b){ll aa=1;while(b){if(b&1){aa=aa*a;aa%=mod;}a=a*a;a%=mod;b/=2;}return aa;}

using namespace std;

int main()
{
  int n;
	cin>>n;
	long double a[n];
	fr(i,0,n) cin>>a[i];
	sort(a,a+n);


	long double deno=a[0];

	fr(i,1,n){
		deno=1.0*(a[i]+deno)/2.0;
	}
	cout<<setprecision(15)<<deno<<"\n";

}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int a[maxn],b[maxn];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    ll ans = 0;
    cin>>n;
    for (int i = 0;i <= n;i ++) cin>>b[i];
    for (int i = 0;i < n;i ++) cin>>a[i];
    for (int i = 0;i <n;i ++)
    {
        if (a[i] > b[i])
        {
            ans += b[i]+min(b[i+1],a[i]-b[i]);
            b[i+1]= max(b[i+1]+b[i]-a[i],0);
        }
        else ans += a[i];
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 1024
process.stdin.resume();
process.stdin.setEncoding('utf8');
// Your code here!

function main(input) {
    const args = input.split(" ")
    const a = args[0]
    const b = args[1]
    
    if((a * b) % 2 === 0) {
        console.log("Even")
    } else {
        console.log("Odd")
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7624
#include <stdio.h>

int main(void)
{
    int a, b, c;
    int square, diamond;

    square = diamond = 0;
    while (scanf("%d,%d,%d", &a, &b, &c) != EOF){
        if (a * a + b * b == c * c){
            square++;
        }
        else if (a == b){
            diamond++;
        }
    }

    printf("%d\n", square);
    printf("%d\n", diamond);

    return (0);
}

Measured memory_bytes: 596
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

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

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

int main() {
  string s;
  while(getline(cin, s)){
    if(s[0]=='.') return 0;
    stack<char> st;
    bool good = true;
    for(auto e: s){
      if(e=='(' || e=='[') st.push(e);
      else if(e==')' || e==']'){
        if(st.size()==0){
          good = false;
          break;
        }
        else if((e==')' && st.top()=='(') || (e==']' && st.top()=='[')) st.pop();
        else{
          good = false;
          break;
        }
      }
    }
    if(good==true && st.size()==0) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}


Measured memory_bytes: 3136
// clang-format off
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort(all(x), greater<>())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl;
template<class T>bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
const int INF = 1e9;
const ll LINF = 1e18;
// clang-format on

void solve(long long A, long long B, long long K) {
  ll t = min(A, K);
  K -= t;
  A -= t;
  t = min(B, K);
  B -= t;
  ANS(A << " " << B);
}

int main() {
  long long A;
  scanf("%lld", &A);
  long long B;
  scanf("%lld", &B);
  long long K;
  scanf("%lld", &K);
  solve(A, B, K);
  return 0;
}


Measured memory_bytes: 256
X = int(input())
y =10**5
a ={i**5 for i in range(-y,y)}
ans_a =0
ans_b =0
for b in range(-y,y):
    if X +b**5 in a:
        #ans_a =int( (X +b**5 +1)**0.2 )
        if X +b**5 >0:
            ans_a =int( (X +b**5 )**0.2 )
        else:
            ans_a = -int( abs(X +b**5 )**0.2 )
        ans_b =b
        break
print(ans_a,ans_b)

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

#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define debug(x)  cerr << #x << " = " << x << endl
using namespace std;

typedef long long ll;
typedef long double ld;
typedef string str;
typedef pair<ll, ll> pll;

const ld PI = 3.14159265359;

const ll MOD = (ll) 1e9 + 7;
const ll MAXN = (ll) 1e5 + 10;
const ll INF = (ll) 2242545357980376863;
const ld EPS = (ld) 1e-12;

ll a[MAXN], b[MAXN];
int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n;
	cin >> n;
	ll s = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		s -= a[i];
	}
	ll p = 0;
	for(int i = 0; i < n; i++){
		cin >> b[i];
		s += b[i];
	}
	ll nd = s, d = 0, st;
	ll A = nd, B = nd;
	for(int i = 0; i < n;i++){
		if(a[i]%2 != b[i]%2){
			b[i] ++;
			B--;
		}
		if(a[i] < b[i]){
			d = (b[i] - a[i]) / 2ll;
			a[i] += (d + d);
			A -= d;
		}else if(b[i] < a[i]){
			d = (a[i] - b[i]);
			b[i] += d;
			B -= d;
		}
	
		//debug(A); debug(B);
	}
	//debug(A); debug(B);
	if(min(A,B) < 0) return cout << "No", 0;
	if(A + A == B) cout << "Yes";
	else cout << "No";
	return 0;
}


/*

                                 ____              ,----..               ,----..
   ,---,                       ,'  , `.           /   /   \             /   /   \
  '  .' \                   ,-+-,.' _ |          /   .     :           /   .     :
 /  ;    '.              ,-+-. ;   , ||         .   /   ;.  \         .   /   ;.  \
:  :       \            ,--.'|'   |  ;|        .   ;   /  ` ;        .   ;   /  ` ;
:  |   /\   \          |   |  ,', |  ':        ;   |  ; \ ; |        ;   |  ; \ ; |
|  :  ' ;.   :         |   | /  | |  ||        |   :  | ; | '        |   :  | ; | '
|  |  ;/  \   \        '   | :  | :  |,        .   |  ' ' ' :        .   |  ' ' ' :
'  :  | \  \ ,'        ;   . |  ; |--'         '   ;  \; /  |        '   ;  \; /  |
|  |  '  '--'          |   : |  | ,             \   \  ',  /          \   \  ',  /
|  :  :                |   : '  |/               ;   :    /            ;   :    /
|  | ,'                ;   | |`-'                 \   \ .'              \   \ .'
`--''                  |   ;/                      `---`                 `---`
                       '---'

*/




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

int main() {
    int A, B; cin >> A >> B;
    ll res = 0;

    res = max(A+B, max(A-B, A*B));
    cout << res << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int a[n];
    int cnt = 1;
    int odd_cnt = 1;
    for( int i = 0; i < n; ++i ) {
        cin >> a[i];
        cnt *= 3;
        if( !(a[i] % 2) ) odd_cnt *= 2;
    }

    cout << cnt - odd_cnt << endl;
    return 0;
}



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

int main() {
  int n;
  string s;
  cin >> n >> s;
  int answer = 0;
  for(int i = 0; i < n - 2; i++) {
    if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') {
      answer++;
    }
  }
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int a, b, x;
	cin>>a>>b>>x;
	if(x>=a && x<=a+b) cout<<"YES\n";
	else cout<<"NO\n";
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[]args) {
		Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int a[]=new int[n];
      int max=0;
      int m=0;
      for(int i=0;i<n;i++){
        a[i]=sc.nextInt();
        max=Math.max(max,a[i]);
        m+=a[i];
      }
      System.out.println((m>2*max)?"Yes":"No");
	}
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  double N,K,m,r=2;
  cin >> N >> K;
  double A=0;
  m=N;
  if (N>=K) {A+=(N+1-K)/N;m=K-1;}
  while (K>1) {
    long long K2=(K-1)/2;
	if (m>K2) A+=(m-K2)/r/N;
	r*=2;
	K=K2+1;
	if (m>K2) m=K2;
  }
  cout << fixed << setprecision(12) << A << endl;
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b; cin>>a>>b;
  int ans,mouth=1;
  while(1){
    if(mouth>=b) break;
    else{
      mouth--;
      mouth+=a;
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        int max = Math.max(a, Math.max(b, c));
        System.out.println(a + b + c - max);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
using vd= vector<double>;
using vc= vector<char>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()


int main(){
  int n,ans=0;
  cin >> n;
  vi d(n);
  rep(i,n)  cin >> d[i];

  rep(i,n){
    rep(j,n){
      if(i==j)  break;
      ans+= d[i]*d[j];
    }
  }
  cout << ans << endl;
}

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

int GCD(int a, int b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main(void){
    int N;
    scanf("%d", &N);
    int ans;
    int input;
    scanf("%d", &ans);
    for (int i = 1; i < N; i++) {
        scanf("%d", &input);
        ans = GCD(ans, input);
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long mod=998244353,n,a,b,k;
long pow(long a,long b){return b?pow(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long fac[3<<17];
long c(long a,long b){
	return fac[a]*pow(fac[a-b],mod-2)%mod*pow(fac[b],mod-2)%mod;
}
main()
{
	cin>>n>>a>>b>>k;
	fac[0]=fac[1]=1;
	for(int i=2;i<=n;i++)fac[i]=i*fac[i-1]%mod;
	long ans=0;
	for(long i=0;i<=n;i++)
	{
		long j=(k-a*i)/b;
		if(j<0||j>n||a*i+b*j!=k)continue;
		ans=(ans+c(n,i)*c(n,j)%mod)%mod;
	}
	cout<<ans<<endl;
}


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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

typedef long long LL;
const LL mod=1000000007;
#define MAX 10000
#define NIL -1
const double PI  = acos(-1.0);

//-------------------------------------------


int main(){

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

    int N,M;
    cin >> N;

    string s[N];
    REP(i,N){
        cin >> s[i];
    }

    cin >> M;
    string t[M];

    REP(i,M){
        cin >> t[i];
    }

    int cnt = 0;
    int cnt2 = 0;
    int maxi = 0;


    REP(i , N){

        cnt = 0;
        cnt2 = 0;
        REP(j , N){
            if ( s[j] == s[i] ){
                cnt++; //dump(cnt);
            }
        }
        REP(k, M){
            if(  t[k] == s[i]  ){
                cnt2++; //dump(cnt2);
            }
        }

        int cntst = cnt - cnt2;
        //dump(cntst);
        maxi = max( cntst, maxi);
    }

    if (maxi > 0) cout << maxi;
    else cout << 0;

    return 0;
}


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

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

int N;
int A[51],B[51];
int M;
int U[21],V[21];
vector<pair<int,ll>> E[51];
ll P[51][51];
ll C[21];

void dfs(int cur,int pre,int id,ll m) {
	P[id][cur]=m;
	FORR(e,E[cur]) if(e.first!=pre) dfs(e.first,cur,id,m|e.second);
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N-1) {
		cin>>A[i]>>B[i];
		A[i]--;
		B[i]--;
		E[A[i]].push_back({B[i],1LL<<i});
		E[B[i]].push_back({A[i],1LL<<i});
	}
	FOR(i,N) dfs(i,i,i,0);
	
	cin>>M;
	FOR(i,M) {
		cin>>x>>y;
		C[i]=P[x-1][y-1];
	}
	
	ll ret=0;
	int mask;
	FOR(mask,1<<M) {
		ll m=0;
		FOR(i,M) if(mask&(1<<i)) m|=C[i];
		ll pat=1LL<<(N-1-__builtin_popcountll(m));
		if(__builtin_popcount(mask)%2==0) {
			ret+=pat;
		}
		else {
			ret-=pat;
		}
		
	}
	cout<<ret<<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);
	cout.tie(0); solve(); return 0;
}


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

    using namespace std;
    template <typename T>
    void debug(string t, T input) {
        cout<<t<<"-> "<<input<<"\n";
    }
    template <typename T>
    void debug(int i,string t, T input) {
        cout<<"Case#"<<i<<" "<<t<<"-> "<<input<<"\n";
    }

    const long long mod=1e9+7;
    long long dp[100005];
    long long power(long long a, long long b){
        if(b==0)
            return 1LL;
        if(b==1)
            return 1LL*a%mod;
        if(b%2==0){
            long long x=power(a,b/2);
            x=(x*x)%mod;
            return x;
        }
        else{
            long long x=power(a,(b-1)/2);
            x=(x*x)%mod;
            return (x*a)%mod;
        }
    }

    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        long long n,k;
        cin>>n>>k;
        for(int i=k;i>=1;i--){
            dp[i]=power(k/i,n);
            for(int j=2*i;j<=k;j+=i)
                dp[i]-=dp[j];
        }
        long long ans=0;
        for(int i=1;i<=k;i++){
            ans=(ans+(dp[i]*i)%mod)%mod;
        }
        cout<<ans%mod;
        return 0;
    }


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

int solve(vector<int> &a, int z) {
	int N = a.size();
	int res = 0;
	int sum = 0;
	for(int i = 0; i < N; ++i) {
		sum += a[i];
		if ((i + z) % 2 == 0) {
			if (sum <= 0) {
				res += abs(sum) + 1;
				sum = 1;
			}
		} else {
			if (sum >= 0) {
				res += abs(sum) + 1;
				sum = -1;
			}
		}
	}
	return res;
}

signed main(){
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	cout << min(solve(a, 0), solve(a, 1)) << endl;
	return 0;
}


Measured memory_bytes: 1024
ans = []

loop do
  n = gets.to_i
  break if n.zero?

  a = n.times.map { gets.to_i }

  max = a.max
  min = a.min
  sum = a.inject :+
  ave = (sum - max - min) / (n - 2)
  ans << ave
end

ans.each do |a|
  p a
end



Measured memory_bytes: 6884
// AOJ 1058 Winter Bells
// 2018.3.1 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define QMAX 500
typedef struct { int t, s; } QUE;
QUE que[QMAX]; int qsize;

#define PARENT(i) ((i)>>1)
#define LEFT(i)   ((i)<<1)
#define RIGHT(i)  (((i)<<1)+1)

void min_heapify(int i)
{
	int l, r, min;
	QUE qt;

	l = LEFT(i), r = RIGHT(i);
	if (l < qsize && que[l].t < que[i].t) min = l; else min = i;
	if (r < qsize && que[r].t < que[min].t) min = r;
	if (min != i) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		min_heapify(min);
	}
}

void deq()
{
	que[0] = que[--qsize];
	min_heapify(0);
}

void enq(int s, int t)
{
	int i, min;
	QUE qt;

	i = qsize++;
	que[i].s = s, que[i].t = t;
	while (i > 0 && que[min = PARENT(i)].t > que[i].t) {
		qt = que[i], que[i] = que[min], que[min] = qt;
		i = min;
	}
}

#define INF 0x10101010
int hi[101], to[101][101], w[101][101];
int dist1[101], dist2[101];
double path1[101], path2[101];  

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = 10*n + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

void dijkstra(int n, int start, int *dist, double *path)
{
	int i, s, e, d, nd;

	memset(dist, INF, n << 2);
	memset(path, 0, sizeof(double)*n);
	qsize = 0;
	dist[start] = 0, path[start] = 1, enq(start, 0);
	while (qsize) {
		s = que[0].s, d = que[0].t, deq();
		if (dist[s] < d) continue;
		for (i = 0; i < hi[s]; i++) {
			e = to[s][i], nd = d + w[s][i];
			if (dist[e] < nd) continue;
			if (dist[e] > nd) path[e] = 0, dist[e] = nd, enq(e, nd);
			path[e] += path[s];
		}
	}
}

int main()
{
	int n, m, p, k, a, b, c;

	while (n = in()) {
		m = in(), p = in();

		memset(hi, 0, n << 2);
		while (m--) {
			a = in(), b = in(), c = in();
			k = hi[a]++, to[a][k] = b, w[a][k] = c;
			k = hi[b]++, to[b][k] = a, w[b][k] = c;
		}

		dijkstra(n,   0, dist1, path1);
		dijkstra(n, n-1, dist2, path2);

		while (p--) {
			c = in();
			if (dist1[c] + dist2[c] == dist2[0])
				printf("%.12lf\n", (path1[c] * path2[c]) / path2[0]);
			else puts("0.000000000000");
		}
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 2036
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

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

    ll M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    if (D2 == 1) cout << "1\n";
    else cout << 0 << endl;

    cout << flush;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,hmax;
    int h[100];
    cin>>n;
    for (size_t i = 0; i < n; i++) {
        cin >> h[i];
    }
    hmax=h[0];
    int les=1;
    for (size_t i = 1; i < n; i++) {
        if (hmax<=h[i]) {
            les++;
            hmax=h[i];
        }
    }
    std::cout << les << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long n,ans,d;
int main()
{  cin>>n>>d;
   for(int i=1;i<=n;i++)
   {  long long x,y;
      cin>>x>>y;
      if(x*x+y*y<=d*d)ans++;
   }
   cout<<ans;

}

Measured memory_bytes: 3628
#include<stdio.h>
#include<string.h>
#include<string>
#include<iostream>
using namespace std;
int main()
{
	string s;
	cin>> s;
	int p=s.size()-1;
	while(p>=0)
	{
		if(s[p]=='F')
			break;
		p--;
	}
	for(int i=0;i<p;i++)
		printf("%c",s[i]);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
using mat = vector<vector<ll>>;

inline void IOS() { ios::sync_with_stdio(false), cin.tie(0); }

template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
	fill((T *)array, (T *)(array + N), val);
}

const ll INF = 1e16;
const ll MOD = 1e9 + 7;
//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//ll pas[5001][5002];

string s, t;
ll dp[3002][3002] = {};

void plcs(int i, int j){
	if(i == 0 || j == 0)return;
	if(s[i - 1] == t[j - 1]){
		plcs(i - 1,j - 1);
		cout << s[i - 1];
	}
	else {
		if(dp[i - 1][j] > dp[i][j - 1])plcs(i - 1,j);
		else plcs(i, j - 1);
	}
}

signed main(){
	IOS();
	cin >> s >> t;
	int n = s.size(), m = t.size();
	for (int i = 0;i < n;++i) {
		for (int j = 0;j < m;++j) {
			if(s[i] == t[j])dp[i + 1][j + 1] = dp[i][j] + 1;
			else dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
		}
	}
	plcs(n, m);
	cout << endl;
	
}

Measured memory_bytes: 70912
N,K = map(int,input().split())
A = list(map(int,input().split()))
 
inf = 1000000007
ans = 0
for i in range(N):
    cnt1 = cnt2 = 0
    for j in range(i):
        if A[j] < A[i]:
            cnt1 += 1
    for j in range(i,N):
        if A[j] < A[i]:
            cnt2 += 1
    ans += (K*(K+1)//2)*cnt2+((K-1)*K//2)*cnt1
    ans %= inf

 
print(ans)



Measured memory_bytes: 3188
N, K = map(int, input().split())
A = list(map(int, input().split()))

def to_bin_arr(a, digit):
    '''
    2進数の0,1配列に変換する
    ex) a = 6, digit = 5 -> [0,0,1,1,0]
    '''
    t = format(a, 'b').zfill(digit)
    return list(map(int, t))

def digit(a):
    '''
    2進数にしたときの桁数を求める
    '''
    return len(format(a, 'b'))


max_a = max(A)
# 最大桁数
d = max(digit(max_a), digit(K))

# 2進配列化したK, A
K_bin = to_bin_arr(K, d)
A_bin = [to_bin_arr(a, d) for a in A]

# Aの各桁の1の数
# すなわち A xor 0 のときの各桁の和
Axor0 = [0] * d
for ab in A_bin:
    for i in range(d):
        Axor0[i] += ab[i]
Axor1 = [N-x for x in Axor0]

# k桁目以降(k=0,1,...,d-1)が自由に選べるときのfの最大値
def score_after(k):
    s = 0
    for i in range(k, d):
        s += (max(Axor0[i], Axor1[i]) << (d - 1 - i))
    return s

# 上からk桁目までをX=[x0, ..., xk]にしたときのfの最大値を求める
def f(X, free, score):
    k = len(X)

    if k == d:
        return score

    if free:
        return score + score_after(k)
    
    if K_bin[k] == 1:
        a = f(X + [0], True, score + (Axor0[k] << d - 1 - k))
        b = f(X + [1], False, score + (Axor1[k] << d - 1 - k))
        return max(a, b)
    else:
        a = f(X + [0], False, score + (Axor0[k] << d - 1 - k))
        return a

ans = f([], False, 0)
print(ans)

Measured memory_bytes: 56816
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 998244353;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

//gcd,lcm,べき,二進展開
//組み合わせ、mod計算
//最短路問題、bit、union find

///////////////////////////



	
int main() {
	ll a, b;
	cin >> a>> b;
	cout << 6 - a - b;
	
	
	system("PAUSE");
}

Measured memory_bytes: 504
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <queue>
#include <map> 
using namespace std;

#define LL long long


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

	LL num;
	map<LL, LL> mp;

	for (LL i = 0; i < N; i++) {
		//cin >> num;
		scanf("%lld", &num);
		mp[num]++;
	}

	LL size = mp.size();
	if (size == 1) {
		if (mp[0] == N) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	
	if (N % 3 != 0) {
		cout << "No" << endl;
		return 0;
	}

	if (size == 2) {
		if (mp[0] == (N / 3)) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	else if (size == 3) {
		// first: key, second: value
		auto iter = mp.begin();
		LL key1 = iter->first;
		LL val1 = iter->second;

		iter++;
		LL key2 = iter->first;
		LL val2 = iter->second;

		iter++;
		LL key3 = iter->first;
		LL val3 = iter->second;

		if (val1 == val2 && val2 == val3) {
			if ((key1 ^ key2) == key3) {
				cout << "Yes" << endl;
				return 0;
			}
		}
	}

	cout << "No" << endl;
}

Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ll x;
    scanf("%lld",&x);
    if (x % 2 == 1){
        printf("0");
        return 0;
    }
    else{
        x /= 2;
        ll ans = 0;
        ll cur = 5;
        while (x >= cur){
            ans += (x/cur);
            cur *= 5;
        }
        printf("%lld",ans);
    }
}


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

int main(){

    int a,b,c,d;
    int L=0,R=0;

    cin>>a>>b>>c>>d;
    L=a+b; R=c+d;
    if(L>R){ 
        cout<<"Left"<< endl;
    }else if(L<R){
        cout<<"Right"<<endl;
    }else{
        cout << "Balanced" << endl;
    }
}

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

#define mod 1000000007
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repx(i,x,n) for(int i=x;i<n;i++)

// int ans(vector<int>& a,int k){
    
// }

int main(){
    int x;
    cin>>x;
    if(x>=30)cout<<"Yes";
    else cout<<"No";
}


Measured memory_bytes: 3632
/*************************************************************************
	> File Name: 49b.cpp
	> Author: SIU
	> Created Time: 2016年12月10日 星期六 20时11分43秒
 ************************************************************************/

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    char str[120][120];
    for(int i=1;i<=n;i++)
    {
        scanf("%s",&str[i]);
    }
    for(int i=1;i<=n;i++)
    {
        printf("%s\n",str[i]);
        printf("%s\n",str[i]);
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int h,w;

  cin >> h >> w;
  while(h!=0 && w!=0){
    int d = h*h + w*w;
    int d_min = 1000000, h_min = 151, w_min=151;
    for(int j=2; j<=150; j++){
      for(int i=1; i<150; i++){
        if(j>i){
          if(d == (i*i + j*j) && d_min >= (i*i + j*j)){
            if(h<i){

              if(d_min == (i*i + j*j)){
                if(h_min>i){
                  h_min = i;
                  w_min = j;
                  d_min = i*i + j*j;
                }
              }else{
                h_min = i;
                w_min = j;
                d_min = i*i + j*j;
              }
            }

          }else if(d < (i*i + j*j) && d_min >= (i*i + j*j)){

            if(d_min == (i*i + j*j)){
              if(h_min>i){
                h_min = i;
                w_min = j;
                d_min = i*i + j*j;
              }
            }else{
              h_min = i;
              w_min = j;
              d_min = i*i + j*j;
            }

          }
        }
      }
    }
    cout << h_min << " " << w_min << endl;
    cin >> h >> w;
  }
}



Measured memory_bytes: 3116
N = input()
A_list = [int(e) for e in input().split()]

LIMIT = pow(10, 18)
total = 1

if 0 in A_list:
    print('0')
    exit()

for a in A_list:
    total = total * a
    if total > LIMIT:
        print('-1')
        exit()
print(total)

Measured memory_bytes: 21644
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace Free
{
    class Program
    {
        static void CoutingSort(int[] A, int[] B, int n, int k)
        {
            int[] C = new int[k + 1];

            foreach (var v in A) C[v]++;
            for (int i = 1; i <= k; i++) C[i] = C[i] + C[i - 1];
            for (int i = n - 1; i >= 0; i--)
            {
                B[C[A[i]] - 1] = A[i];
                C[A[i]]--;
            }
        }

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] A = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int[] B = new int[n];
            CoutingSort(A, B, n, 10000);
            Console.WriteLine(String.Join(" ", B));
        }
    }
}



Measured memory_bytes: 176056
n = int(input())
h = list(map(int, input().split()))
if n==1:
    print('Yes')
    exit()
ht = h[-1]
for i in reversed(range(n-1)):
    if ht == h[i]-1:
        h[i]-=1
    elif ht < h[i]-1:
        print('No')
        exit()
    ht = h[i]
print('Yes')

Measured memory_bytes: 14396
#include <iostream>

using namespace std;

int main()
{
	static bool prime[1<<15];
	prime[0] = prime[1] = false;
	for ( int i=2; i<1<<15; i++ )
		prime[i] = true;
	for ( int i=0; i<1<<15; i++ )
		if ( prime[i] )
			for ( int j=i+i; j<1<<15; j+=i )
				prime[j] = false;

	int n;
	while ( cin >> n, n != 0 )
	{
		int c = 0;
		for ( int i=1; i<=n-i; i++ )
			if ( prime[i] && prime[n-i] )
				c++;

		cout << c << endl;
	}

	return 0;
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>


int main()
{
    int n;
    while(cin>>n)
    {
        int a,b;
        a=n%10;
        b=n/10;
        if(a==9||b==9)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int R; cin >> R;
    if(R < 1200)
        cout << "ABC";
    else if(R < 2800)
        cout << "ARC";
    else
        cout << "AGC";
    
    
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
int main()
{
    double n,i,sum=0;
    scanf("%lf",&n);
    for(i=1;i<=3;i++)
    {
        sum=sum+pow(n,i);

    }

    printf("%.0lf\n",sum);

    return 0;
}


Measured memory_bytes: 2580
def matmul(p, q):
    r = len(p)
    c = len(q[0])
    ret = []
    for i in range(r):
        row = []
        for j in range(c):
            v = 0
            for k in range(len(q)):
                v += p[i][k] * q[k][j]
            row.append(v)
        ret.append(row)
    return ret

def matpow(p, n):
    if n == 1:
        return p
    rsq = matpow(p, n // 2)
    rr = matmul(rsq, rsq)
    if n % 2 == 0:
        return rr
    else:
        return matmul(rr, p)


def main():
    a, b, c, k = map(int, input().split())
    ans = (a - b) * (1 if (k % 2 == 0) else -1)
    if abs(ans) <= 10 ** 18:
        print(ans)
    else:
        print("Unfair")


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        int c=sc.nextInt();
        System.out.println((b+c-a)>0?(b+c-a):0);
           
    }
}

Measured memory_bytes: 23124
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var n int
	fmt.Scan(&n)
	used := map[string]bool{}
	ws := make([]string, n)
	answer := true
	for i := 0; i < n; i++ {
		sc.Scan()
		ws[i] = sc.Text()
	}

	for i := 0; i+1 < n; i++ {
		if string(ws[i][len(ws[i])-1]) != string(ws[i+1][0]) {
			answer = false
			break
		}
	}

	for _, w := range ws {
		if used[w] {
			answer = false
		}
		used[w] = true
	}

	if !answer {
		fmt.Println("No")
		return
	}
	fmt.Println("Yes")
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,C;
	cin>>n>>C;
	int s[100000],t[100000],c[100000];
	for(int i = 0; i<n; i++)
		cin>>s[i]>>t[i]>>c[i];
	int tt[200002]={0},st[200002]={0};
	for(int i = 1; i<=C; i++)
	{
		memset(tt,0,sizeof(tt));
		for(int j = 0; j<n; j++) 
			if(c[j] == i)
				tt[2*s[j]-1]++,tt[2*t[j]]--;
		for(int j = 1; j<200002; j++) tt[j] += tt[j-1];
		for(int j = 0 ; j<200002; j++) st[j] += (tt[j]>0);
	}
	cout<<*max_element(st,st+200002)<<endl;
	return 0;
}

Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ll long long
#define P pair<int,int>
#define fast_io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int MOD = 1000000007;
const int INF = 2002002002;
const ll LLINF = 9009009009009009009;
using namespace std;

// int gcd(int a, int b)
// {
//    if (a%b == 0)
//    {
//        return(b);
//    }
//    else
//    {
//        return(gcd(b, a%b));
//    }
// }


int main() {
    fast_io
    int n, x;
    cin >> n;
    ll ans = 0;
    rep(i,n) {
        rep(j,n) {
            x = gcd(i+1, j+1);
            rep(k,n) {
                ans += gcd(x, k+1);
            }
        }
    }
    cout << ans << endl;
    return 0;
}


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

#define ll long long
#define ull unsigned long long

using namespace std;

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

	int UB = (N-1)*(N-2)/2;
	if (K > UB){
		cout << -1 << endl;
		return 0;
	}

	// 初期グラフを作成
	int M = N - 1;
	vector<vector<int>> graph(N, vector <int> ());
	for (int ii = 0; ii < N - 1; ++ii){
		graph[ii].push_back(N - 1);	//頂点(N-1)をハブにする
	}

	//目標に到達するまで辺を追加していく
	int now = UB;
	int v1 = 0;
	int v2 = 1;
	while (now > K) {
		graph[v1].push_back(v2);
		//v2が最後までいったらv1, v2を更新
		if (v2 == N - 2){
			v1++;
			v2 = v1 + 1;
		} else {
			v2++;
		}
		now--;
		M++;
	}


	// 結果を出力
	cout << M << "\n";
	for (int ii = 0; ii < N; ++ii){
		for (int jj = 0; jj < graph[ii].size(); ++jj){
			cout << ii + 1 << " " << graph[ii][jj] + 1 << "\n";
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    #define rep(i,n) for(int i=0; i<(n); i++)
    #define FOR(i,a,b) for(int i=(a); i<(b); i++)
    #define ALL(v) v.begin(), v.end()
    #define RALL(v) v.rbegin(), v.rend()
    typedef long long ll;
    int main(){
        int n; cin >> n;
        string s; cin >> s;
        int l = s.size();
        rep(i, l){
            int m = s[i] - 'A' + n;
            m %= 26;
            cout << (char)('A' + m);
            if(i == l - 1) cout << endl;
        }
    }

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll N;
  cin >> N;
  vector<string> s(N);
  queue<string> a, b, ab;
  string ans = "";
  for (int i = 0; i < N; i++) {
    cin >> s[i];
    if (s[i][0] == 'B' && s[i][s[i].size() - 1] == 'A') {
      ab.push(s[i]);
    } else if (s[i][0] == 'B') {
      b.push(s[i]);
    } else if (s[i][s[i].size() - 1] == 'A') {
      a.push(s[i]);
    } else {
      ans += s[i];
    }
  }
  if (!a.empty()) ans += a.front(), a.pop();
  while (!ab.empty()) ans += ab.front(), ab.pop();
  while (!a.empty() || !b.empty()) {
    if (!b.empty()) ans += b.front(), b.pop();
    if (!a.empty()) ans += a.front(), a.pop();
  }
  ll cnt = 0;
  for (int i = 0; i + 1 < ans.size(); i++) {
    if (ans[i] == 'A' && ans[i + 1] == 'B') {
      cnt++;
      i++;
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 4124
c11, c12, c13 = list(map(int, input().split()))
c21, c22, c23 = list(map(int, input().split()))
c31, c32, c33 = list(map(int, input().split()))

print('Yes' if c11 - c21 == c12 - c22 == c13 - c23 and
      c21 - c31 == c22 - c32 == c23 - c33 and
      c31 - c11 == c32 - c12 == c33 - c13 and
      c11 - c12 == c21 - c22 == c31 - c32 and
      c12 - c13 == c22 - c23 == c32 - c33 and
      c13 - c11 == c23 - c21 == c33 - c31 else 'No')


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

using namespace std;

#define LL long long 
#define ULL unsigned long long 
#define LD long double 

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin>>a>>b;
	if((a+b)%2==0)
		cout<<(a+b)/2;
	else
		cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())

alpha = 1 / 6 * h * math.pi + 1 / 360 * m * math.pi
beta = m * math.pi / 30

x_a = a * math.sin(alpha)
y_a = a * math.cos(alpha)
x_b = b * math.sin(beta)
y_b = b * math.cos(beta)

ans = math.sqrt((x_a - x_b) ** 2 + (y_a - y_b) ** 2)

print(ans)

Measured memory_bytes: 9580