akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 2010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

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

int N;
int A[MAX_N];
bool used[MAX_N];
vector<int> G[MAX_N];

vi loop(int v) {
	used[v] = true;
	vector<vi> E;
	vector<int> at;
	vector<int> res;
	vector<int> order;


	if(v != 0) res.pb(A[v]);

	rep(i, 0, sz(G[v])) {
		int n = G[v][i];
		if(used[n]) continue;
		order.pb(i);
	}
	sort(all(order), [&](int a, int b){ return A[G[v][a]] < A[G[v][b]]; });

	rep(i, 0, sz(order)) {
		int n = G[v][order[i]];
		if(!used[n]) {
			E.pb(loop(n));
			at.pb(0);
		}
	}

	int m = sz(E);
	while(true) {
		int a = -1, tat = -1;
		rep(i, 0, m) {
			if(sz(E[i]) == at[i]) continue;
			if(a < E[i][at[i]]) {
				a = E[i][at[i]]; tat = i;
			}
		}
		if(tat == -1) break;
		at[tat]++; res.pb(a);
	}
	return res;
}

void solve() {
	cin >> N;
	rep(i, 0, N) {
		cin >> A[i + 1];
	}
	rep(i, 1, N + 1) {
		rep(j, i + 1, N + 1) {
			if(gcd(A[i], A[j]) != 1) {
				G[i].pb(j);
				G[j].pb(i);
			}
		}
	}
	rep(i, 1, N + 1) {
		G[i].pb(0);
		G[0].pb(i);
	}

	vector<int> ans = loop(0);
	rep(i, 0, N) {
		cout << ans[i] << " ";
	}
	cout << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}




Measured memory_bytes: 23424
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  string s, t; cin >> s >> t;
  int n = s.size();
  VV<> a(26), b(26);
  for (int i = 0; i < n; i++) {
    a[s[i] - 'a'].push_back(i);
    b[t[i] - 'a'].push_back(i);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  cout << (a == b ? "Yes" : "No") << '\n';
}

Measured memory_bytes: 3092
x = input()
if x =='a':
    print('b')
if x =='b':
    print('c')
if x =='c':
    print('d')
if x =='d':
    print('e')
if x =='e':
    print('f')
if x =='f':
    print('g')
if x =='g':
    print('h')
if x =='h':
    print('i')
if x =='i':
    print('j')
if x =='j':
    print('k')
if x =='k':
    print('l')
if x =='l':
    print('m')
if x =='m':
    print('n')
if x =='n':
    print('o')
if x =='o':
    print('p')
if x =='p':
    print('q')
if x =='q':
    print('r')
if x =='r':
    print('s')
if x =='s':
    print('t')
if x =='t':
    print('u')
if x =='u':
    print('v')
if x =='v':
    print('w')
if x =='w':
    print('x')
if x =='x':
    print('y')
if x =='y':
    print('z')


Measured memory_bytes: 9128
x=int(input())
if x<=6:
  print(1)
else:
  ans=(x//11)*2
  if x%11==0:
     pass 
  elif (x//11)%2==0:
    if x%11<=6:
      ans+=1
    else:
      ans+=2
  else:
    if x%11<=5:
      ans+=1
    else:
      ans+=2
  print(ans)

Measured memory_bytes: 3060
from collections import deque
import sys
readline = sys.stdin.readline


def main():
    a = input()
    d = deque(a)
    n = int(input())
    flagr = True
    for i in range(n):
        j = list(readline().split())
        if len(j) == 1:
            flagr = not flagr
        elif int(j[1] == "1") ^ flagr:
            d.append(j[2])
        else:
            d.appendleft(j[2])
    if not flagr:
        d.reverse()
    print("".join(d))


if __name__ == '__main__':
    main()


Measured memory_bytes: 8564
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
#define rep2(i,a,n) for (int i = a; i < n; i++)
using namespace std;
int X;
int main() {
    cin >> X;
    // for(int i = 1; i < pow(10,9)+1; i++) {
    //     int r = pow(i,5)-X;
    //     double B;
    //     if (r < 0) {
    //     B = -1 * pow(-r, 0.2);
    //     } else {
    //        B = pow(r, 0.2);
    //     }
    //     // cout << B << endl;
    //     if (floor(B) == B ) {
    //         cout << i << " " << B << endl;
    //         break;
    //     }
    // }
    for(int i = 1; i < pow(10,3)+1;i++) {
        for(int b = -1*pow(10,3)-1; b < pow(10,3);b++) {
            int num = pow(i, 5) - pow(b,5);
            if(num == X) {
                cout << i << " " << b << endl;
                return 0;
            }
        }
    }
    // cout << pow(-1,0.2) << endl;
    // cout << pow(pow(2,5)-X, 0.2) << endl;
    return 0;
}


Measured memory_bytes: 4104
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> sum(n+1);
    sum[0] = 0;
    rep(i, n) {
        cin >> a[i];
        sum[i+1] = (sum[i] + a[i]) % mod;
    }
    ll ans = 0;
    rep(i, n) {
        ll tmp = sum[n] - sum[i+1];
        //cout << tmp << endl;
        if (tmp < 0) tmp += mod; 
        ans = (ans + a[i] * tmp) % mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6352
#include <bits/stdc++.h>
using namespace std;
int gcd(int a,int b){
	return b==0?a:gcd(b,a%b);
}
int pre[100100],suf[100100];
int a[100100];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	int cnt=a[1];
	pre[1]=a[1];
	for(int i=2;i<=n;i++){
		pre[i]=gcd(a[i],cnt);
		cnt=pre[i];
	}
	cnt=a[n];
	suf[n]=a[n];
	for(int i=n-1;i>=1;i--){
		suf[i]=gcd(a[i],cnt);
		cnt=suf[i];
	}
	int ma=max(suf[2],pre[n-1]);
	for(int i=2;i<=n-1;i++){
		ma=max(gcd(pre[i-1],suf[i+1]),ma);
	}
	printf("%d\n",ma);
	return 0;
}


Measured memory_bytes: 1408
N,M=[int(s) for s in input().split()]
AB=[[int(s) for s in input().split()] for i in range(N)]
AB.sort(key=lambda it: it[0])

pay=0
num=0
for a,b in AB:
    m=min(M-num, b)
    num=num+m
    pay=pay+a*m
    if num >= M:
        print(pay)
        break

Measured memory_bytes: 22760
def li():
    return list(map(int, input().split()))
def mi():
    return map(int, input().split())
def ii():
    return int(input())

N = ii()
A = li()
cnt = 0
while all(e % 2 == 0 for e in A):
    cnt += 1
    A = list(map(lambda x: x // 2, A))

print(cnt)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>

#define rep(i,a,n) for(int i=a;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

// Debug Vector
template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

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


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
////    CLion Standard Input for DEBUG
////    --------------------------------------------------------------------------
//    ifstream in("./in.txt");
//    cin.rdbuf(in.rdbuf());
////    --------------------------------------------------------------------------
    int x, a, b;
    cin >> x >> a >> b;
    if(a - b >= 0) cout << "delicious" << endl;
    else if (a - b <= 0 && b - a  <= x) cout << "safe" << endl;
    else cout << "dangerous" << endl;
    return 0;





}


Measured memory_bytes: 256
# ABC097D - Equals (ARC097D)
class UnionFind:
    __slots__ = ["_data_size", "_first_index", "_parents"]

    def __init__(self, data_size: int, is_zero_indexed: bool = True) -> None:
        self._data_size = data_size
        self._first_index = 0 if is_zero_indexed else 1
        self._parents = [-1] * (data_size + self._first_index)

    def find(self, x: int) -> int:
        """Find the group (root) of vertex x"""
        if self._parents[x] < 0:
            return x
        self._parents[x] = self.find(self._parents[x])
        return self._parents[x]

    def is_same(self, x: int, y: int) -> bool:
        """Return whether two vertices x and y are in the same group or not."""
        return self.find(x) == self.find(y)

    def unite(self, x: int, y: int) -> None:
        """Unite two groups of vertices x and y."""
        x, y = self.find(x), self.find(y)
        if x == y:
            return
        if self._parents[x] > self._parents[y]:
            x, y = y, x
        self._parents[x] += self._parents[y]
        self._parents[y] = x


def main():
    N, _, *PXY = map(int, open(0).read().split())
    P, XY = PXY[:N], PXY[N:]
    uf = UnionFind(N, is_zero_indexed=False)
    for x, y in zip(*[iter(XY)] * 2):
        uf.unite(x, y)
    ans = sum(uf.is_same(i, p) for i, p in enumerate(P, 1))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 35316
#include <iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    int a[n],b[n];
    int i,k,l;
    int ue,sita;
    int goukei[n];
    int max=0;
    
    
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(i=1;i<=n;i++)
    {
        cin>>b[i];
    }
    
    for(k=1;k<=n;k++)
    {
        goukei[k]=0;
        ue=0;
        sita=0;
        for(l=1;l<=k;l++)
        {
            ue +=a[l];
        }
        
        for(l=k;l<=n;l++)
        {
            sita +=b[l];
        }
        
        goukei[k] = ue + sita;

        
        
        
    }
    for(k=1;k<=n;k++)
    {
        if(goukei[k]>=max)
        {
            max=goukei[k];
        }
    }
    
    cout<<max<<endl;
    
    
    
    return 0;
    
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}

//for(int i = ; i < ; i++){}

int main(){
  int n;
  cin>>n;
  vector <pair<int, int> > v(n);
  ll sum=0;
  for(int i = 0; i < n; i++){
    cin>>v[i].second;
    cin>>v[i].first;
    sum+=v[i].second;
  }
  sort(v.begin(),v.end());
  bool b = true;
  
  for(int i = n-1; i>=0; i--){
    
    if(sum>v[i].first){
      b = false;
      break;
    }
    else{
      sum-=v[i].second;
    }
  }
  
  if(b==true)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}




Measured memory_bytes: 1792
#include <cstdio>

void trace(int A[], int N) {
	int i;
	for( i = 0; i < N; i++ ) {
		if(i > 0) printf(" ");
		printf("%d", A[i]);
	}
	printf("\n");
}

void bubbleSort(int A[], int N) {
	int j, flag, counter;
	flag = 1, counter = 0;
	while(flag) {
		flag = 0;
		for( j = N-1; j > 0; j-- )
			if( A[j] < A[j - 1] ) {
				int v = A[j - 1];
				A[j - 1] = A[j];
				A[j] = v;
				counter++;
				flag = 1;
			}
	}
	trace(A, N);
	printf("%d\n", counter);
}

int main()
{
	const int MAXN = 100;
	int N, i, A[MAXN];

	scanf("%d", &N);
	for( i = 0; i < N; i++ ) scanf("%d", &A[i]);

	bubbleSort(A, N);

	return 0;
}


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

int main(void) {
    int N, M, K;
    cin >> N >> M;
    int food[M+1] = {0};
    int array[N][M];
    int i, j;
    int cnt = 0;

    for (i = 0; i < N; i++) {
        cin >> K;
        for (j = 0; j < K; j++) {
            cin >> array[i][j];
            food[array[i][j]] += 1;
        }
    }

    for (i = 0; i <= M; i++) {
        if (food[i] == N) {
            cnt += 1;
        }
    }

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

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;
using ll = long long;

vector<pair<int, int>> number(vector<int> v){
	vector<pair<int, int>> ans(2);
	int k = v.size(), now = 0, len = 0;
	for (int i = 0; i < k; i++){
		if (v[i] != now){
			if (ans[0].first < len){
				swap(ans[0], ans[1]);
				ans[0].first = len, ans[0].second = now;
			}
			else if (ans[1].first < len)ans[1].first = len, ans[1].second = now;
			len = 0;
			now = v[i];
		}
		len++;
	}
	if (ans[0].first < len){
		swap(ans[0], ans[1]);
		ans[0].first = len, ans[0].second = now;
	}
	else if (ans[1].first < len)ans[1].first = len, ans[1].second = now;

	return ans;
}

int main(){
	int n;
	cin >> n;
	vector<int> p, q;
	for (int i = 0; i < n; i++){
		int a;
		cin >> a;
		if (i % 2 == 0)p.push_back(a);
		else q.push_back(a);
	}
	sort(p.begin(), p.end());
	sort(q.begin(), q.end());
	vector<pair<int, int>> a = number(p);
	vector<pair<int, int>> b = number(q);
	if (a[0].second != b[0].second)cout << n - a[0].first - b[0].first << endl;
	else if (a[1].first > b[1].first)cout << n - a[1].first - b[0].first << endl;
	else cout << n - a[0].first - b[1].first << endl;
}

Measured memory_bytes: 892
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

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

  int N2 = (N-1) + (L-K);
  cout << N2 << endl;

  for (int i = 2; i <= N; ++i) {
    cout << 1 << " " << i << endl;
  }
  N2 -= N - 1;

  for (int i = 2; i <= N && N2 > 0; ++i) {
    for (int j = i + 1; j <= N && N2 > 0; ++j) {
      cout << i << " " << j << endl;
      --N2;
    }
  }
}


Measured memory_bytes: 3588
#include<cstdio>
#include<algorithm>

using namespace std;

#define int long long
#define INF ((long long)1e18)
#define rep(i,n) for(int i = 0; i < (n); i++)

#define MAX 110000
	
int s[MAX], t[MAX], ans[MAX];
pair<int,int> x[MAX];

signed main(){

	int A, B, Q, a, b, c, d;
	
	scanf("%lld %lld %lld", &A,&B,&Q);
	
	rep(i,A)scanf("%lld",&s[i]);
	rep(i,B)scanf("%lld",&t[i]);
	rep(i,Q){scanf("%lld",&x[i].first);x[i].second = i;}
	
	sort(x,x+Q);
	
	for(int i = 0, j = 0, k = 0; i < Q; i++){
		for(;j < A && x[i].first >= s[j];j++);
		for(;k < B && x[i].first >= t[k];k++);
		a = j?x[i].first-s[j-1]:INF,b = j-A?s[j]-x[i].first:INF,c = k?x[i].first-t[k-1]:INF,d = k-B?t[k]-x[i].first:INF;
		ans[x[i].second] = min(min(max(a,c),max(b,d)),min(a>d?d*2+a:a*2+d,b>c?c*2+b:b*2+c));
	}
	
	rep(i,Q) printf("%lld\n",ans[i]);
	
	return 0;
}

Measured memory_bytes: 5248
#include <stdio.h>
#include<string.h>
int main(void) {
	
	int t;
	int i,arr[1000000];
	char str[1000000];
	scanf("%s",str);
	for(i=0;i<26;i++){
		arr[i++]=0;
	}
	int l=strlen(str);
	int j;
	for(i=0;i<l;i++){
		arr[(str[i]-97)]++;
	}
	for(i=0;i<26;i++){
		if(arr[i]%2!=0){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 2176
using System;

namespace ALDS1_5_C
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            point x = new point(0d, 0d);
            point y = new point(100d, 0d);

            Console.WriteLine("{0} {1}", x.x, x.y);
            Koch(x, y, N);
            Console.WriteLine("{0} {1}", y.x, y.y);

        }

        public class point
        {
            public double x, y;

            public point (double x, double y)
            {
                this.x = x;
                this.y = y;
            }
        }

        public class vector
        {
            public double vx, vy, r, rad;

            public vector (point p, point q)
            {
                this.vx = q.x - p.x;
                this.vy = q.y - p.y;
                this.r = Math.Sqrt(this.vx * this.vx + this.vy * this.vy);
                this.rad = Math.Atan2(this.vy, this.vx);
            }
        }

        public static void Koch (point p, point q, int N)
        {
            if (N == 0) return;
            vector pq = new vector(p, q);
            point s = new point(p.x + pq.r * Math.Cos(pq.rad) / 3, p.y + pq.r * Math.Sin(pq.rad) / 3);
            point t = new point(p.x + 2 * pq.r * Math.Cos(pq.rad) / 3, p.y + 2 * pq.r * Math.Sin(pq.rad) / 3);
            vector st = new vector(s, t);
            point u = new point(s.x + st.r * Math.Cos(st.rad + (Math.PI / 3)), s.y + st.r * Math.Sin(st.rad + (Math.PI / 3)));

            
            Koch(p, s, N - 1);
            Console.WriteLine("{0} {1}", s.x, s.y);
            Koch(s, u, N - 1);
            Console.WriteLine("{0} {1}", u.x, u.y);
            Koch(u, t, N - 1);
            Console.WriteLine("{0} {1}", t.x, t.y);
            Koch(t, q, N - 1);
            
        }
    }
}

Measured memory_bytes: 9560
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

int main(){
    int A,B,C;cin>>A>>B>>C;
    set<int> S;
    S.insert(A);
    S.insert(B);
    S.insert(C);
    if(S.size()==2){cout<<"Yes"<<endl;}
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
<?php
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($A,$B) = array_map('intval',explode(" ",trim(fgets(STDIN))));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$ans = 1;
foreach($A as $a) {
  $ans = $ans * $a;
}

if ($ans >10**18) {
  $ans = -1;
}
printf("%d\n",$ans);


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

#define F first
#define S second
#define pb push_back
#define ld  double
#define ll long long
#define int long long


using namespace std;

const int MAXN = 101 * 1001 , MOD = 1e9 + 7  ;

int n , t;

int a[MAXN] ;

int ans = 0 ;

int get(int x , int k)
{
    ans = max(ans,k * x - 2LL * k * k);
    return k * x - 2LL * k * k ;
}

int32_t main()
{
   ios::sync_with_stdio(0);cin.tie(0);
   cin >> n >> t ;
   for(int i = 0 ; i < n ; i ++ )
        cin >> a[i] ;

   int mx = -1 ;
   for(int i = n - 1 ; i > -1 ; i -- )
   {
       mx = max(mx,a[i]);
       ans = max(ans,(t/2)*(mx-a[i])) ;
   }

   int mn = 0 ;

   pair < int , int > mxx = {-1,1};
   for(int i = n - 1 ; i > -1 ; i -- )
   {
       if(a[i]>mxx.F)
        mxx.F=a[i],mxx.S = 0 ;
       if(a[i]==mxx.F)
        mxx.S ++ ;
       if((t/2)*(mxx.F-a[i])==ans)
        mn += mxx.S ;
   }
   cout<<mn;


}


Measured memory_bytes: 1024
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;

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);
        Solver solver = new Solver();
        solver.solve(in, out);
        out.close();
    }

    static class Solver {
        public void solve(Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int K = in.nextInt();

            long count = 0;

            List<Integer> hList = new ArrayList<>();
            for (int i = 0; i < N; i++) {
                int H = in.nextInt();
                hList.add(H);
                count += H;
            }
            hList.sort(Comparator.reverseOrder());

            for (int i = 0; i < K; i++) {
                if (i >= hList.size()) {
                    break;
                }
                count -= hList.get(i);
            }

            out.println(count);
        }
    }
}

Measured memory_bytes: 96416
loop{
    a, op, b= gets.split
    case op
    when "+"
        puts a.to_i+b.to_i
    when "-"
        puts a.to_i-b.to_i
    when "*"
        puts a.to_i*b.to_i
    when "/"
        puts a.to_i/b.to_i
    when "?"
        break
    end
}

Measured memory_bytes: 8656
#include<iostream>
using namespace std;
int n,h[2001],ans=0;
bool check(int x)
{
    for(int i=x-1;i>=1;i--)
    {
        if(h[i]>h[x])return 0;
    }
    return 1;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)cin>>h[i];
    for(int i=1;i<=n;i++)
    {
    	if(check(i))ans++;
	}
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <numeric>
#include <limits>
#include <cmath>
#include <iomanip>
#include <sstream>
 
#define ALL(a)  (a).begin(),(a).end()
 
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

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

    ll ans = 0;

    ll n;
    ll a[3][3];
    int c[3][3];
    
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> a[i][j];
        }
    }

    cin >> n;
    for (int i = 0; i < n; i++) {
        int b;
        cin >> b;
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                if (a[i][j] == b) c[i][j] = true;
            }
        }
    }

    //yoko
    for (int i = 0; i < 3; i++) {
        int check = 0;
        for (int j = 0; j < 3; j++) {
            if (c[i][j] == true) check++;
        }
        if (check >= 3) ans = 1;
    }

    //tate
    for (int i = 0; i < 3; i++) {
        int check = 0;
        for (int j = 0; j < 3; j++) {
            if (c[j][i] == true) check++;
        }
        if (check >= 3) ans = 1;
    }

    //
    int check = 0;
    for (int i = 0; i < 3; i++) {
        if (c[i][i] == true) check++;
    }
    if (check >= 3) ans = 1;

    //
    check = 0;
    for (int i = 0; i < 3; i++) {
        if (c[i][2-i] == true) check++;
    }
    if (check >= 3) ans = 1;

    (ans == 1) ? (cout << "Yes" << endl) : (cout << "No" << endl);

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

struct stack
{
    int max_index;
    int* con;
    int index = 0;
    stack(int n = 100) : max_index(n) {
        con = new int[n];
    }

    void push(int v)
    {
        if(max_index > index){
            con[index++] = v;
        }
    }

    int pop()
    {
        if(index != 0)
        {
            return con[--index];
        }
        else{
            return 0;
        }
    }
};

void step()
{
    char c[100];
    stack S;
    while(1)
    {
        cin >> c;
        if(!cin.good() or c[0] == 'e') break;
        if(c[0] == '+')
        {
            int a = S.pop();
            int b = S.pop();
            S.push(a + b);
        }
        else if(c[0] == '-')
        {
            int a = S.pop();
            int b = S.pop();
            S.push(b - a);
        }
        else if(c[0] == '*')
        {
            int a = S.pop();
            int b = S.pop();
            S.push(a * b);
        }
        else
        {
            S.push(atoi(c));
        }
    }
    cout << S.pop() << endl;
}

int main()
{
    step();
}



Measured memory_bytes: 3120
#include<iostream>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<algorithm>
#include<cmath>
#include<tuple>
#include<iomanip>
#include<list>
#include<climits>
#define endl '\n'
#define ll long long
#define ld long double
#define sp fixed<<setprecision
#define bp __builtin_popcountll
#define mod 1000000007
#define mod1 998244353
#define PI acos(-1)
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>=k)
    {
        cout<<k;
    }
    else if(a+b>=k)
    {
        cout<<a;
    }
    else
    {
        int r = k-a-b;
        cout<<a-r;
    }
    
    return 0;
}

Measured memory_bytes: 3652
MV = { 'U' => [-1, 0], 'D' => [1, 0], 'L' => [0, -1], 'R' => [0, 1] }
Tank = { '^' =>'U', 'v' => 'D', '<' => 'L', '>' => 'R' }

gets.to_i.times do |i|
  puts if i > 0
  h, w = gets.split.map(&:to_i)
  fld = (h+2).times.map{''}
  fld[0] = fld[h+1] = ' '*(w+2)
  y, x = 0, 0 
  z = ''
  h.times do |i|
    f = gets.chomp
    Tank.keys.each do |t|
      if f.include?(t)
        y, x = i+1, f.index(t)+1
        z = Tank[t]
      end
    end
    fld[i+1] << ' ' + f + ' '
  end 

  n = gets.to_i
  tank = gets
  n.times do |j|
    if tank[j] == 'S'
      my, mx = y, x
      while fld[my][mx] != ' '
        my += MV[z][0]; mx += MV[z][1]
        if fld[my][mx] == '*'
          fld[my][mx] = '.'
          break
        elsif fld[my][mx] == '#'
          break
        end
      end
    else
      z = tank[j]
      if fld[y + MV[z][0]][x + MV[z][1]] == '.'
        fld[y][x] = '.'
        y += MV[z][0]; x += MV[z][1]
        fld[y][x] = Tank.key(z)
      else
        fld[y][x] = Tank.key(z)
      end
    end
  end
  (1..h).each{ |j| puts fld[j][1,w] }
end

Measured memory_bytes: 8824
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

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

	vector<int> chars(26, 1000);

	string s;
	for (int i = 0; i < n; i++) {
		cin >> s;
		for (int i  = 0; i < 26; i++) {
			chars[i] = min(chars[i], (int)count(s.begin(), s.end(), 'a' + i));
		}
	}

	string ans;
	for (int i = 0; i < 26; i++) {
		ans += string(chars[i], 'a' + i);
	}

	cout << ans << endl;
	return 0;
}


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

#define MAX 50

int A[MAX];
int n;


int check(int i, int m) {
  if ( m == 0 ) return 1;
  else if ( i >= n ) return 0;
  int res = check(i + 1, m) || check(i + 1, m - A[i]);
  return res;
}

int main() {
  int q, key;

  cin >> n;
  for ( int i = 0; i < n; i++ ) {
    scanf("%d", &A[i]);
  }

  cin >> q;
  for ( int i = 0; i < q; i++ ) {
    cin >> key;
    if ( check(0, key) ) {
      cout << "yes" << endl;
    } else {
      cout << "no" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 3220
#include <stdio.h>
int main(){
	int a,c;
	char b;
	int n;
	scanf("%d ",&a);
	scanf("%c ",&b);
	scanf("%d",&c);
	if(b=='+'){
		printf("%d\n",a+c);
	}
	if(b=='-'){
		printf("%d\n",a-c);
	}
	
	
	return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
using namespace std;

int f[8] = {4,1,4,1,2,1,2,1};
int n[8] = {41412121,14121214,41212141,12121414,21214141,12141412,21414121,14141212};
	
void output(int n){
	for(int i=0 ; i<8 ; i++){
		cout << f[(i+n)%8];
		(i==7)? cout << endl : cout << " "; 
	}
}

int main(){
	int p[8], c[8];
	int min1, min2, ans;

	while(cin>>p[0]>>p[1]>>p[2]>>p[3]>>p[4]>>p[5]>>p[6]>>p[7]){
		for(int i=0 ; i<8 ; i++) c[i]=0;
		min1 = 99999999;
		min2 = 99999999;
		
		for(int i=0 ; i<8 ; i++){
			for(int j=0 ; j<8 ; j++){
				int a = p[j] - f[(i+j)%8];
				if (a<0) a = 0;
				c[i] += a;
			}
		}
		for(int i=0 ; i<8 ; i++){
			if(min1>c[i]){
				ans = i;
				min1 = c[i];
				min2 = n[i];
			}else if(min1==c[i] && min2>n[i]){
				ans = i;
				min1 = c[i];
				min2 = n[i];
			}
		}
		output(ans);
	}

	return 0;
}

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CShoppingStreet {
        public void solve(int testNumber, inputClass sc, PrintWriter out) {
            int n = sc.nextInt();
            int[][] f = new int[n][10];
            int[][] p = new int[n][11];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 10; j++) {
                    f[i][j] = sc.nextInt();
                }
            }
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 11; j++) {
                    p[i][j] = sc.nextInt();
                }
            }
            int ans = Integer.MIN_VALUE;
            for (int mask = 1; mask < (1 << 10); mask++) {
                int[] nb = new int[n];
                for (int i = 0; i < 10; i++) {
                    if ((mask & (1 << i)) > 0) {
                        for (int j = 0; j < n; j++) {
                            if (f[j][i] == 1) {
                                nb[j]++;
                            }
                        }
                    }
                }
                int act = 0;
                for (int i = 0; i < n; i++) {
                    act += p[i][nb[i]];
                }
                ans = Math.max(ans, act);
            }
            out.println(ans);
        }

    }

    static class inputClass {
        BufferedReader br;
        StringTokenizer st;

        public inputClass(InputStream in) {

            br = new BufferedReader(new InputStreamReader(in));
        }

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll s; cin >> s;

    set<ll> st;
    st.insert(s);
    for(int i=2;;i++){
        ll tmp;
        if(s%2==0)  tmp = s/2;
        else tmp = 3*s+1;

        if(st.count(tmp)){
            cout << i << endl;
            return 0;
        }

        s = tmp;
        st.insert(s);
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
#define int long long
#define MAX 10

int c[MAX][MAX];

void warshall_floyd() {
  for (int k = 0; k < MAX; k++) {
    for (int i = 0; i < MAX; i++) {
      for (int j = 0; j < MAX; j++) {
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }
}

signed main() {
  int h, w;
  cin >> h >> w;
  for (int i = 0; i < MAX; i++) {
    for (int j = 0; j < MAX; j++) {
      cin >> c[i][j];
    }
  }
  int a[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      cin >> a[i][j];
    }
  }
  warshall_floyd();
  int d[MAX];
  for (int i = 0; i < MAX; i++) {
    d[i] = c[i][1];
  }
  int ans = 0;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] >= 0) {
        ans += d[a[i][j]];
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
using namespace std;

typedef long long STATES;

int main( void )
{
	STATES free_days[31], dp[51], goal_state, next;
	int i, j, n, answer, free_day, k;

	while ( scanf( "%d", &n ) == 1 && n )
	{
		memset( free_days, 0, sizeof(free_days) );
		memset( dp, 0, sizeof(dp) );

		goal_state = 0;
		for ( i = 0; i < n; i++ ) goal_state |= 1LL << i;

		for ( i = 0; i < n; i++ )
		{
			scanf( "%d", &k );
			for ( j = 0; j < k; j++ )
			{
				scanf( "%d", &free_day );
				free_days[free_day] |= 1LL << i;
			}
		}

		answer = -1;
		for ( i = 0; i < n; i++ ) dp[i] = 1LL << i;
		STATES* p = free_days + 1;
		for ( i = 1; i <= 30; i++, p++ )
		{
			next = 0;
			for ( j = 0; j < n; j++ ) if ( *p & 1LL << j ) next |= dp[j];
			if ( next == goal_state )
			{
				answer = i;
				break;
			}
			for ( j = 0; j < n; j++ ) if ( *p & 1LL << j ) dp[j] |= next;
		}

		printf( "%d\n", answer );
	}

	return 0;
}

Measured memory_bytes: 760
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;
set<int> st;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    int N;
    cin >> N;
    for(int i = 0; i < N; i++){
        int a;
        cin >> a;
        if(st.count(a) > 0){
            cout << "NO" << endl;
            return 0;
        }
        st.insert(a);
    }
    cout << "YES" << endl;
}

Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int N; cin >> N;
  pair<double, char> xmi={inf, 'a'}, xma={-inf, 'a'}, ymi={inf, 'a'}, yma={-inf, 'a'};
  double l=inf, r=-inf, u=-inf, d=inf;
  double igail = -inf, igair = inf, igaiu = inf, igaid = -inf;
  rep(i, N){
    double a, b; char c; cin >> a >> b >> c;
    if(c=='L') l=min(l, a); else igail = max(igail, a);
    if(c=='R') r=max(r, a); else igair = min(igair, a);
    if(c=='U') u=max(u, b); else igaiu = min(igaiu, b);
    if(c=='D') d=min(d, b); else igaid = max(igaid, b);
    if(a<xmi.first){
      xmi = {a, c};
    }
    if(a>xma.first){
      xma = {a, c};
    }
    if(b<ymi.first){
      ymi = {b, c};
    }
    if(b>yma.first){
      yma = {b, c};
    }
  }
  //cout << xmi.first << " " << xma.first << " " << ymi.first << " " << yma.first << endl;
  //cout << l << " " << r << " " << u << " " << d << endl;
  double ans=longinf;
  for(double t=0.0; t<=3*100000000; t+=0.5){
    double xm = min({xmi.first + (xmi.second=='R')*t, l-t, igair});
    double xM = max({xma.first - (xma.second=='L')*t, r+t, igail});
    double ym = min({ymi.first + (ymi.second=='U')*t, d-t, igaiu});
    double yM = max({yma.first - (yma.second=='D')*t, u+t, igaid});
    //if(t==3.0) cout << xm << " " << xM << " " << ym << " " << yM << endl;
    //if((xM-xm)*(yM-ym)==60.0){
      //cout << xm << " " << xM << " " << ym << " " << yM << " " << t << endl;
    //}
    ans = min(ans, (xM-xm)*(yM-ym));
  }
  printf("%.11lf\n", ans);
}

Measured memory_bytes: 256
// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

// AtCoder.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//


#define _USE_MATH_DEFINES
#include<math.h>

//#include<cmath>

#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>



//#include "Ants.h"
using namespace std;
typedef long long ll;
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define rep(i,n) for(int i=0;i<n;i++)
#define show(s) cout<<s<<endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define LINF (1000000000000000000ll)
//typedef pair < int, int> P;
ll gcd(ll a, ll b) {//最大公約数を求める///最大公倍数a*b/gcd(a,b)
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcd(ll a, ll b) {//最小公倍数を求める　b=0のときaを返す
	if (b == 0) return a;
	return (a / gcd(a, b)) * b;
}
vector<int> divnum(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p;
}
int digiter(ll num) {
	int dig;
	vector<int>p;
	while (num) {
		dig = num % 10;
		p.push_back(dig);
		num /= 10;
	}
	return p.size();
}
vector<int> convertstring(string s) {
	vector<int> d;
	ll n = s.size();
	rep(i, n) {
		d.push_back(s[i] - '0');
	}
	return d;
}
map< int64_t, int > prime_factor(int64_t n) {
	map< int64_t, int > ret;
	for (int64_t i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			ret[i]++;
			n /= i;
		}
	}
	if (n != 1) ret[n] = 1;
	return ret;
}
vector<ll> divisor(ll n) {
	vector<ll>res;
	for (ll i = 1; i * i <= n; i++) {
		if (n % i != 0)continue;
		res.push_back(i);
		if (i * i != n)res.push_back(n / i);
	}
	return res;
}
ll MOD = 1000000007;
ll N, K;
ll dp[100005];
ll res[100005];
void calc(const ll x) {
	ll y = dp[x];
	ll p = x;
	y += MOD;
	//cout << y << endl;
	while (p<= K) {
		p += x;
		if (p > K)break;
		y -= res[p];
		y += MOD;
		//cout << res[p] <<" "<<x<<" " <<p << endl;
	}
	res[x] = y;
	res[x] %= MOD;
}
ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}
int main()
{
	ll ans = 0;
	cin >> N >> K;
	for (int Gcd = K; Gcd >=1 ; --Gcd) {
		ll amt = K / Gcd;
		//dp[Gcd] = ll(pow(amt, N));
		dp[Gcd] = myPow(amt,N,MOD);
		
		calc(Gcd);
		ans += (res[Gcd]%MOD)*Gcd;
		ans %= MOD;
		
	}
	ll cnt = 0;

	
	
	
	cout << ans%MOD << endl;
}


Measured memory_bytes: 5192
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	x := nextInt()

	ans := x / 11 * 2

	if x%11 > 0 {
		if x%11 > 6 {
			ans += 2
		} else {
			ans++
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
#pragma warning(disable:4996)
#include <stdio.h>


/* 値を入れ替える */
void swap(int* x, int* y) {
	int temp;    // 値を一時保存する

	temp = *x;
	*x = *y;
	*y = temp;
}

/* ソート昇順 */
void bubble_sort(int array[], int array_size) {
	int i, j, x;
	for (i = 0; i < array_size - 1; i++) {
		for (j = array_size - 1, x = 0; j >= i + 1; j--, x++) {   //　右から左に操作
			if (array[j] < array[j - 1]) { swap(&array[j], &array[j - 1]); }
		}
	}
}

int main(void) {
	int n;
	int u[50];
	double U[50];
	double ans_, ans = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &u[i]);
	}
	bubble_sort(u, n);
	for (int i = 0; i < n; ++i) {
		U[i] = u[i];
	}
	for (int i = 1; i < n; ++i) {
		U[i] = (U[i] + U[i - 1]) / 2;
	}
	printf("%f", U[n - 1]);
	return 0;
}

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

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

    vector<int> b(n);
    for(int i = 0; i < n; i++) b[i] = a[i]-i-1;
    sort(b.begin(), b.end());
    long long int ans = 1001001001001001;
    for(int i = n/2-3; i <= n/2+3; i++){
        if(i < 0 || i >= n) continue;
        for(int b1 = b[i]-10; b1 <= b[i]+10; b1++){
            long long int coans = 0;
            for(int j = 0; j < n; j++){
                coans += abs(a[j]-b1-j);
            }
            if(coans < ans) ans = coans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4788
#include<stdio.h>
#include<stdlib.h>
#define NIL NULL

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};

typedef struct node * Node;


Node root;


void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while(x != NIL){
    y = x;
    if(z->key < x->key)
      x = x->left;
    else
      x = x->right;
  }
    z->parent = y;

    if(y == NIL)
      root = z;
    else if(z->key < y->key)
      y->left = z;
    else
      y->right = z;
      
 
}


Node treeSearch(Node u, int k){
  if(u == NIL || k == u->key) return u;
  if(k < u->key) return treeSearch(u->left , k);
  else return treeSearch(u->right , k);

}

void inorder(Node u){

  if(u != NIL){
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
  }
}

void preorder(Node u){

  if(u != NIL){

    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
  }
}

int main(){
  int i,m,x;
  char com[20];
  
  scanf("%d",&m);

  for(i = 0 ; i < m ; i++){
    scanf("%s",com);
    if(com[0] == 'i'){
      scanf("%d",&x);
      insert(x);
    }

    else if(com[0] == 'p'){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
    else if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}

Measured memory_bytes: 19364
a, v = map(int, input().split()); 
b, w = map(int, input().split());
t = int(input());

if v <= w:
    print("NO");
else:
    if a > b:
        c = a - b;
    else:
        c = b - a;
        
    if (v - w) * t >= c:
        print("YES");
    else:
        print("NO");

Measured memory_bytes: 9184
N = int(input())
l = list(map(int, input().split(' ')))

counter = {}

for i in l:
    if i in counter:
        counter[i] = counter[i] + 1
    else:
        counter[i] = 1

a = None
b = None
for k in sorted(counter.keys(), reverse=True):
    if counter[k] >= 4 and a == None and b == None:
        a = k
        b = k
    elif counter[k] >= 2 and a == None:
        a = k
    elif counter[k] >= 2 and a != None:
        b = k
    if (a != None and b != None):
        break

if (a != None and b!= None):
    print(a * b)
else:
    print('0')



Measured memory_bytes: 18060
import java.util.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int[] num = new int[9];
    
    for(int i=0; i<9; i++){
        num[i] = sc.nextInt();
    }
    if(num[0]-num[3]==num[1]-num[4] && num[2]-num[5]==num[1]-num[4] && num[0]-num[3]==num[2]-num[5]){
      if(num[0]-num[6]==num[1]-num[7] && num[2]-num[8]==num[1]-num[7] && num[0]-num[6]==num[2]-num[8]){
        if(num[3]-num[6]==num[4]-num[7] && num[5]-num[8]==num[4]-num[7] && num[3]-num[6]==num[5]-num[8]){
          System.out.println("Yes");
        }else{
          System.out.println("No");
        }
      }else{
          System.out.println("No");
        }
    }else{
          System.out.println("No");
        }
    //System.out.println(count);
  }
}

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

int main(){
  int N;
  
  cin >> N;
  vector<int> a(N);
  for(int i = 0;i < N;i++) cin >> a.at(i);
  
  sort(a.begin(), a.end());
  
  cout << a.at(N-1) - a.at(0) << endl;
  
  return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>

int main( int argc , char *argv[] )
{
	char a[1000][1000];
	int ax[1000*1000][2];
	int ay[1000*1000][2];
	int c = 0;
	int c2 = 0;
	int st = 0;
	int st2 = 1;
	int x,y;
	int h,w;
	int i;

	scanf( "%d %d\n" , &h , &w );

	x = 0;
	y = 0;

	for( i = 0 ; i < h*w ;) {
		int ch = getchar();

		if( ch != '.' && ch != '#' ) {
			continue;
		}

		a[y][x] = ch;

		if( ch == '#' ) {
			ax[c][0] = x;
			ay[c][0] = y;
			c++;
		}

		x++;
		i++;

		if( x == w ) {
			x = 0;
			y++;
		}
	}

	for( i = 0 ; i < 2000 ; i++ ) {
		int f = 0;
		int j;

		c2 = 0;
		
		st = ( st == 0 ? 1 : 0 );
		st2 = ( st2 == 0 ? 1 : 0 );

		for( j = 0 ; j < c ; j++ ) {
			x = ax[j][st2];
			y = ay[j][st2];

			if( x > 0 ) {
				if( a[y][x-1] == '.' ) {
					a[y][x-1] = '#';

					ax[c2][st] = x-1;
					ay[c2][st] = y;
					c2++;
				}
			}
			if( x < w-1 ) {
				if( a[y][x+1] == '.' ) {
					a[y][x+1] = '#';

					ax[c2][st] = x+1;
					ay[c2][st] = y;
					c2++;
				}
			}
			if( y > 0 ) {
				if( a[y-1][x] == '.' ) {
					a[y-1][x] = '#';

					ax[c2][st] = x;
					ay[c2][st] = y-1;
					c2++;
				}
			}
			if( y < h-1 ) {
				if( a[y+1][x] == '.' ) {
					a[y+1][x] = '#';

					ax[c2][st] = x;
					ay[c2][st] = y+1;
					c2++;
				}
			}
		}

		c = c2;

		if( c2 == 0 ) {
			printf( "%d\n" , i );

			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 16768
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define FF fflush(stdout)
#define debug printf("Hello\n")
//why is my rating plummeting
int n, m, k, x, y, sum, cnt, ans, f[30];
char s[1005];
int main () {
	scanf("%d %d", &n, &m);
	for (int i=0; i<n; i++) {
		scanf("%s", s);
		for (int j=0; j<m; j++) {
			f[s[j]-'a']++;
		}
	}
	for (int i=0; i<26; i++) {
		if (f[i]%2) cnt++;
	}
	if (cnt>1) return 0*printf("No\n");
	if (cnt==1&&!(n%2==1&&m%2==1)) return 0*printf("No\n");
	if (cnt==0&&n%2==1&&m%2==1) return 0*printf("No\n");
	if (n%2==1&&m%2==1) {
		for (int i=0; i<26; i++) if (f[i]%2) f[i]--;
	}
	cnt=0;
	for (int i=0; i<26; i++) {
		if (f[i]%4==2) cnt++;
	}
	if (n%2) ans+=m/2;
	if (m%2)ans+=n/2;
	if (cnt>ans) return 0*printf("No\n");
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 256