akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int main (void){

    int a,b,c,tmp;

scanf("%d %d %d",&a,&b,&c);

if(a > b){
    tmp =a,a = b,b = tmp;
}
if(b > c){
    tmp =b,b = c,c = tmp;
}
if(a > b){
    tmp =a,a = b,b = tmp;
}

printf("%d %d %d\n",a,b,c);

return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const ll MAX_N = ll(2e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

struct UnionFindTree {
    int par[MAX_N];
    int rank[MAX_N];
    int siz[MAX_N];

    void init(int n) {
        for (int i = 0; i < n; i++) {
            par[i] = i;
            rank[i] = 0;
            siz[i] = 1;
        }
    }
    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    }
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        par[y] = x;
        siz[x] += siz[y];
    }
    bool is_same(int x, int y) {
        return find(x) == find(y);
    }
    int size(int x) {
        x = find(x);
        return siz[x];
    }
};

int n, m;
UnionFindTree g;
bool ok = true;

int main() {
    cin >> n >> m;
    g.init(n+m+1);
    REP(i,n){
        int k;
        cin >> k;
        REP(j,k){
            int l;
            cin >> l;
            g.unite(i+1,l+n);
        }
    }
    for(int i=1; i<n; i++){
        if(!g.is_same(i,i+1))ok = false;
    }
    cout << (ok?"YES":"NO") << endl;
    return 0;
}


Measured memory_bytes: 2560
#include <iostream>
using namespace std;
long long L[100];
int N;
int main(){
	cin >> N;
  	L[0] = 2; L[1] = 1;
  	for(int i=2;i<=N;i++){
		L[i] = L[i-1]+L[i-2];
    }
  cout << L[N] << endl;
}


Measured memory_bytes: 764
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());

		String[] s_nums = br.readLine().split(" ");

		int[] nums = new int[s_nums.length];

		for (int i = 0; i < n; i++) {
			nums[i] = Integer.parseInt(s_nums[i]);

		}

		boolean jeudge = true;

		int count =0;

		while(jeudge){
			jeudge = false;
			for(int k = nums.length-1; k>=1; k--){

				if(nums[k]<nums[k-1]){
					int a = nums[k];

					nums[k] =nums[k-1];

					nums[k-1] =a;

					count++;

					jeudge = true;
				}
			}
		}
		StringBuilder sb = new StringBuilder();
		for(int i=0; i<n; i++){
			sb.append(nums[i]);
			sb.append(" ");
		}

		System.out.println(sb.toString().trim());
		System.out.println(count);
	}


}

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

int main() {
  int N;
  cin >> N;
  vector<int> ts(N);
  int totalT = 0;
  for(int i = 0; i < N; ++i) {
    cin >> ts[i];
    totalT += ts[i];
  }
  int M;
  cin >> M;
  vector<pair<int, int>> ds(M);
  for(int i = 0; i < M; ++i) {
    cin >> ds[i].first >> ds[i].second;
  }
  for(auto d : ds) {
    auto t = totalT - ts[d.first - 1] + d.second;
    cout << t << endl;
  }
  return 0;
}

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

#define ll long long
#define sd(x) scanf("%d", &(x))
#define pii pair<int, int>
#define F first
#define S second

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif


#define ld long double
const ll mod = 1e16 + 61;

ld inv = 1. / (ld)mod;

ll mul(ll a, ll b){
    ll x = (ll)((ld)a*(ld)b*inv +(ld)(1)/2.);
    ll ret = a*b-mod*x;
    if((ll)(ret) < 0)
        ret+=mod;
    return ret;
}

ll add(ll a, ll b){
	 a += b;
	 if(a >= mod) a -= mod;
	 return a;
}

ll sub(ll a, ll b){
	a -= b;
	if(a < 0) a += mod;
	return a;
}

const int base = 97;

const int N = 605;
char s[N][N];

ll rwhsh[N][N], colhsh[N][N];
ll pw[N];
int n;

inline ll getrowhsh(int i, int j, int k){
	return sub(rwhsh[i][k], mul(rwhsh[i][j - 1], pw[k - j + 1]));
}

inline ll getcolhsh(int i, int j, int k){
	return sub(colhsh[k][i], mul(colhsh[j - 1][i], pw[k - j + 1]));
}

bool chk(int i, int j){
	for(int k = 1; k <= n; k++) if(getrowhsh(i + k - 1, j, j + n - 1) != getcolhsh(j + k - 1, i, i + n - 1)){
		return 0;
	}
	return 1;
}

int main(){
	sd(n);
	pw[0] = 1;
	for(int i = 1; i < N; i++) pw[i] = mul(pw[i - 1], base);
	for(int i = 1; i <= n; i++){
		scanf("%s", s[i] + 1);
		for(int j = n + 1; j <= 2 * n; j++) s[i][j] = s[i][j - n];
		for(int j = 1; j <= 2 * n; j++) s[i + n][j] = s[i][j];
	}

	for(int i = 1; i <=  2 * n; i++){
		for(int j = 1; j <= 2 * n; j++){
			rwhsh[i][j] = (rwhsh[i][j - 1] * (ll) base + s[i][j] - 'a' + 1) % mod;
			colhsh[i][j] = (colhsh[i - 1][j] * 1ll * base + s[i][j] - 'a' + 1) % mod;
			// cerr << rwhsh[i][j]<<endl;
		}
	}
	int ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++)
			ans += chk(i, j);
	}
	cout << ans;
}

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

int main() {
  char s[3];
  
  cin >> s ; 
  
  if (s[0]== '7' ||s[1]== '7' ||s[2]== '7' ){
   cout <<   "Yes" << endl ; 
  }
    else {
      cout << "No" << endl ;
    }
  







}


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

int main() {
    int N;
    string s,t;
    cin >> N >> s >> t;
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < N;j++) {
            if(s[i+j] != t[j]) break;
            if(N == i+j+1) {
                cout << i + N << endl;
                return 0;
            }
        }
    }
    cout << N * 2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long a[100005],b[100005],x,y;
long long n;
cin>>n;
for(int i=1;i<=n;i++)
cin>>a[i];
b[n-1]=abs(a[n]-a[n-1]);
b[n]=0;
for(int i=n-2;i>=1;i--)
{
    x=abs(a[i]-a[i+1])+b[i+1];
    y=abs(a[i]-a[i+2])+b[i+2];
    if(x>=y)
    b[i]=y;
    if(x<y)
    b[i]=x;
}
cout<<b[1];
return 0;
}




Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  int K,N;
  cin>>N>>K;
  vector<int> A(N);
  rep(i,N) cin>>A[i];

  sort(all(A));

  int ans=0;
  rep(i,K) ans+=A[i];
  cout<<ans<<endl;

  return 0;
}


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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<long long> As(N);
    for (auto & a : As) cin >> a;
    long long cum = accumulate(As.begin(), As.end(), 0LL);
    long long record = abs(cum - As[0] - As[0]);
    for (int i = 0; i < N - 1; ++i){
        cum -= 2 * As[i];
        record = min(record, abs(cum));
    }
    cout << record << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define pii pair<ll,ll>
#define ll long long
#define tii tuple<ll,ll,ll>
#define all(v) (v).begin(),(v).end()
#define deb(x) cout << #x << "=" << x << endl;
#define ull unsigned long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(nullptr);
#define ld long double
#define mod 998244353
#define PI 3.141592653589793238
#define phi 1.638
#define eps 1e-9
#define endl "\n"
using namespace std;
using namespace __gnu_pbds;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;      



int main() {
    fastio
    ll n, x, m;
    cin>>n>>x>>m;

    ll ans = x;
    ll cnt = 1;
    vector<ll> v = {x};
    map<ll, int> mp;
    mp[x] = 1;
    ll rep = 0;
    while(x != 0 && cnt<n) {
        x *= x;
        x %= m;
        if(x == 0) {
            cout<<ans<<endl;
            return 0;
        }

        if(mp[x]) {
            rep = x;
            break;
        }

        v.push_back(x);
        mp[x] = 1;

        ans += x;
        cnt++;
    }

    int ind = 0;
    for(int i = 0; i<v.size(); ++i) {
        if(v[i] == x) {
            ind = i;
            break;
        }
    }
    ll len = v.size() - ind;

    ll rem = n - cnt;
    ans += (rem/len)*(accumulate(v.begin()+ind, v.end(), 0ll));
    ans += accumulate(v.begin()+ind, v.begin()+ind+(rem%len), 0ll);
    cout<<ans<<endl;
}

Measured memory_bytes: 6716
import java.util.*;
class Dice {
	private int c , n , w , e , s , r;
	public Dice(int c, int n, int e, int s, int w, int r) {
		this.c = c;
		this.n = n;
		this.e = e;
		this.w = w;
		this.s = s;
		this.r = r;
	}
	/* ã c@º r
	 * ¶ w@E e
	 *  n@O s */
	public int North() {
		int tmp = this.c;
		this.c = this.s;
		this.s = this.r;
		this.r = this.n;
		this.n = tmp;
		return this.c;
	}
	public int East() {
		int tmp = this.c;
		this.c = this.w;
		this.w = this.r;
		this.r = this.e;
		this.e = tmp;
		return this.c;
	}
	public int South() {
		int tmp = this.c;
		this.c = this.n;
		this.n = this.r;
		this.r = this.s;
		this.s = tmp;
		return this.c;
	}
	public int West() {
		int tmp = this.c;
		this.c = this.e;
		this.e = this.r;
		this.r = this.w;
		this.w = tmp;
		return this.c;
	}
	public int Right() {
		int tmp = this.n;
		this.n = this.w;
		this.w = this.s;
		this.s = this.e;
		this.e = tmp;
		return this.c;
	}
	public int Left() {
		int tmp = this.n;
		this.n = this.e;
		this.e = this.s;
		this.s = this.w;
		this.w = tmp;
		return this.c;
	}
}
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while ( !sc.hasNext("0") ) {
			Dice d = new Dice(1,5,3,2,4,6);
			int c = sc.nextInt() , sum = 1;
			for ( int i = 0; i < c; i++ ) {
				String order = sc.next();
				sum += order.equals("South") ? d.South()
						: order.equals("North") ? d.North()
						: order.equals("West") ? d.West()
						: order.equals("East") ? d.East()
						: order.equals("Left") ? d.Left()
						: order.equals("Right") ? d.Right() : 0;
			}
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int bt=0,bd=0;
    for(int i = 0; i < n; i++){
        int t,x,y;
        cin >> t >> x >> y;
        t -= bt;
        bd = abs(x+y-bd);
        if(bd > t || bd%2 != t%2){
            cout << "No";
            return 0;
        }
        bt = t;
    }
    cout << "Yes";
}

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

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

using ll=long long;
const int Nmax=100010;
int N; 
ll dp[3][Nmax];
int v[3][Nmax];
const ll INF=1LL<<60;


int main(){
  cin >> N;
  for (int j=0;j<N;j++){
    for (int i=0;i<3;i++){
      cin >> v[i][j];
    }
  }
  for (int i=0;i<3;i++){
    for (int j=0;j<N;j++){
      dp[i][j]=0;
    }
  }
  for (int i=0;i<3;i++)
    dp[i][0]=v[i][0];
  
  for (int j=0;j<N;j++){
    for (int i=0;i<3;i++){
      for (int k=0;k<3;k++)
        if (k!=i) chmax(dp[i][j+1],v[i][j+1]+dp[k][j]);
    }
  }
  
  ll ans=0;
  for (int i=0;i<3;i++)
    chmax(ans,dp[i][N-1]);
  
  cout << ans << endl;
  
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,k,tmp;
    cin>>n>>k;
    tmp=(n%k==0?n/k-1:n/k);
    tmp=n-tmp*k;
    cout<<min(tmp,k-tmp);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  map<string, int> mp;
  rep(i, N) {
    string S;
    cin >> S;
    mp[S]++;
  }
  vector<string> ans;
  int mx = 0;
  for (auto p : mp) {
    if (p.second > mx) {
      ans = {p.first};
      mx = p.second;
    } else if (p.second == mx) {
      ans.push_back(p.first);
    } else {
      continue;
    }
  }
  sort(ans.begin(), ans.end());
  rep(i, sz(ans)) cout << ans[i] << '\n';
  return 0;
}

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

template<typename T>
T get_value(std::istream& is);

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

  int A, B, C, X;
  cin >> A >> B >> C >> X;

  auto sum {0u};
  for (auto i {min(X / 500, A)}; i != -1; --i)
    for (auto j {min((X - i*500) / 100, B)}; j != -1; --j)
      for (auto k {min((X - i*500 - j*100) / 50, C)}; k != -1; --k)
        if (X == i*500 + j*100 + k*50)
          ++sum;

  cout << sum << '\n';
  return 0;
}

template<typename T>
inline T get_value(std::istream& is)
{
  T v;
  is >> v;
  return v;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < int(n); ++(i))
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
using ll = long long;
using namespace std;

ll gcd(ll a, ll b) { while (a) { b %= a; swap(a, b); } return b; }

bool solve(vector<ll> & a, ll k) {
    assert (not a.empty());
    assert (k != 0);
    whole(sort, a);
    a.erase(whole(unique, a), a.end());
    if (a.back() < k) return false;
    ll gcd_a = a[0]; for (ll a_i : a) gcd_a = gcd(gcd_a, a_i);
    if (k % gcd_a != 0) return false;
    return true;
}

int main() {
    int n; ll k; scanf("%d%lld", &n, &k);
    vector<ll> a(n); repeat (i, n) scanf("%lld", &a[i]);
    bool result = solve(a, k);
    printf("%s\n", result ? "POSSIBLE" : "IMPOSSIBLE");
    return 0;
}

Measured memory_bytes: 1024
// Author : Nachiket Kanore
// Institute : PICT, Pune

#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <cassert>
#include <cstring>
#include <cstdarg>
#include <cstdio>
#include <memory>
#include <random>
#include <cmath>
#include <ctime>
#include <unordered_map>
#include <unordered_set>
#include <functional>
#include <algorithm>
#include <complex>
#include <numeric>
#include <limits>
#include <bitset>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <array>
#include <list>
#include <map>
#include <set>

using namespace std;

#define int long long
#define endl '\n'
#define null nullptr
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
 
 
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef pair<int,int> pii;
 
const int mod = 1e9+7;
const int inf = 1e18;



int32_t main(){
    FAST;

    priority_queue<int> f;
    int n , m;
    cin >> n >> m;

    for(int x=0;x<n;x++){
        int t;  cin >> t;
        f.push(t);
    }

    int sum = 0;

    while(m--){
        int t = f.top() / 2;
        f.pop();
        f.push(t);
    }

    while(!f.empty()){
        sum += f.top();
        f.pop();
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 1400
#include <iostream>
using namespace std;
int main(void){
    int N, a, b, c, d, x, y;
    int bm, dm, as;

    cin >> N >> a >> b >> c >> d;
    x = (N/a);
    y = (N%a);
    if (y != 0) x++;
    bm = x * b;
    x = (N/c);
    y = (N%c);
    if (y != 0) x++;
    dm = x * d;
    if (bm > dm) {
        as = dm;
    } else {
        as = bm;
    }

    cout << as << endl;
    return 0;
}


Measured memory_bytes: 3096
#include<cstdio>  
int a,l1,l2,n;
bool f;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
	    f=0;l1=0;l2=-1;
		for(int j=1;j<=10;j++)
		{
			scanf("%d",&a);
			if(!f&&a<l2&&a<l1){printf("NO\n");f=1;continue;}
			if(!f&&l1>l2)
			{
				if(l1<a)l1=a;
				else l2=a;
			} 
			if(!f&&l2>l1)
			{
				if(l2<a)l2=a;
				else l1=a;
			}
		}
		if(!f)printf("YES\n");
	}
}

Measured memory_bytes: 2600
//#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<stack>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<algorithm>
typedef long long LL;
using namespace std;
//#pragma comment(linker, "/STACK:102400000,102400000")

/*
Problem C.
有一种数只有1/0，即二进制数，但是不存在两个连续的1.
输入n，求第n个这样的数。
*/

int main(){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(b-a==c-b) puts("YES");
    else puts("NO");
    return 0;
}



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

int gcd(int a, int b)
{
    int c;

    if (a < b) {
        a+=b; b=a-b; a-=b;
    }

    while (b != 0) {
        c = a % b;
        a = b;
        b = c;
    }

    return a;
}

int main(void){
    int a, b;
    cin >> a >> b;
    cout << a - b + 1 << endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
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; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long int ll;
typedef long double ld;
const ll INF=(1LL<<62);
const ld pi=acosl((ld)-1);
const ll mod = 1000000007;
// const ll mod = 1234567;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"
#define TO_STRING(VariableName) # VariableName

template <typename T>ostream &operator<<(ostream &out,const vector<T> &v) {rep(i,(int)v.size()-1)cout<<v[i]<<" ";cout<<v[(int)v.size()-1];return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const map<T1, T2> &p) {out << "(" << p.first << ", " << p.second << ")";return out;}
template <typename T1, typename T2>ostream &operator<<(ostream &out, const pair<T1, T2> &p){out << "(" << p.first << ", " << p.second << ")";return out;}
template<class T>void debag(const T &obj){cout<<obj<<endl;}

bool solve(){
  string s,t;cin>>s>>t;
  t.pop_back();
  cout<<(s==t ? "Yes" : "No")<<endl;
  return false;
}

signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout<<fixed<<setprecision(30);
  solve();
}


Measured memory_bytes: 3656
#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define print(x) cout<<x<<endl;
typedef long long ll;

int main() {
	ll n;
	string s;
	cin >> n;
	cin >> s;
	int max_x = 0, x = 0;
	rep(i, 0, n) {
		//print(s[i]);
		if (s[i] == 'I') { x++; }
		else { x--; }
		max_x = max(max_x, x);
	}
	print(max_x);
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <numeric>

using namespace std;

int main(void){
    int T,X;
    cin>>T;
    cin>>X;
    double ans = (double)T/X;
    printf("%f",ans);

    return 0;
}

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

int getMaxLen(vector<int> &v, int tmpMaxLen) {
  
  int size = v.size();
  int max_len = 0;
  if (size <= 3) {
	return tmpMaxLen;
  }
  
  int midInd = size / 2;
  int val = v[midInd];
  int st;
  int end;
  int next_val;
  for (end = midInd + 1; end < size; end++) {
    next_val = v.at(end);
    if (val < next_val) {
      break;
    }
    val = next_val;
  }
  
  val = v[midInd];
  int later_val;
  for (st = midInd; st >= 1; st--) {
    later_val = v[st - 1];
    if (val > later_val) {
      break;
    }
    val = later_val;
  }
  
  int tmp1 = end - st;
  if (tmp1 > tmpMaxLen) {
    tmpMaxLen = tmp1;
  }
  
  if (st > tmpMaxLen + 1) {
    vector<int> v1(st + 1);
    for (int i = 0; i < st; i++) {
      v1.at(i) = v.at(i);
    }
    v1.at(st) = 1000000001;
    tmpMaxLen = getMaxLen(v1, tmpMaxLen);
  }
  
  if (end + tmpMaxLen < size - 1) {
    vector<int> v2(size - end + 1);
    v2[0] = 0;
    for (int i = end; i < size; i++) {
      v2.at(i - end + 1) = v.at(i);
    }
    tmpMaxLen = getMaxLen(v2, tmpMaxLen);
  }
  
  return tmpMaxLen;
}


int main(){
  int N;
  cin >> N;
  
  vector<int> h(N + 2);
  h.at(0) = 0;
  h.at(N + 1) = 1000000001;
  for (int i = 1; i < N + 1; i++) {
    cin >> h.at(i);
  }

  int tmpMaxLen = 1;
  int maxLen = getMaxLen(h, tmpMaxLen);
  cout << maxLen - 1;
}


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

#define rep(i, n)	for(int i = 0; i < (int)(n); i++)

int N, W;
int weight[1010] = {};
int value[1010] = {};

int dp[110][10010] = {};

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

	rep (i, N) {
		cin >> value[i + 1] >> weight[i + 1];
	}

	for (int n = 1; n <= N; n++) {
		for (int w = 0; w <= W; w++) {

			// そもそも入るか
			if (w >= weight[n]) {
				dp[n][w] = max(dp[n - 1][w], dp[n - 1][w - weight[n]] + value[n]);
			}
			else {
				dp[n][w] = dp[n - 1][w];
			}

		}
	}

	cout << dp[N][W] << endl;

	return 0;
}


Measured memory_bytes: 6992
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<cmath>
using lint=int64_t;
using namespace std;

constexpr double pi=3.141592653589793;

double a,b,x;

double SS(double rad)
{
	if(b*sin(rad)>=a*sin(pi/2+rad))
		return a*b-a*a*tan(pi/2-rad)*(1.0/2);
	else
		return b*b*tan(rad)*(1.0/2);
}

int main()
{
	cin >> a >> b >> x;

	double l,r;
	l=0,r=pi/2;
	for(int i=0;i<10000;i++)
	{
		double mid=(l+r)/2;
		if(SS(mid)>=x/a)r=mid;
		else l=mid;
	}
	cout << fixed << setprecision(9);
	cout << 90.0-r*(180/pi) << endl;
	return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author gainullin.ildar
 */

#include <bits/stdc++.h>


#include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <iomanip>

using namespace std;


typedef long long ll;

const int N = 1e5 + 7;

int pr[N];

int get(int v)
{
    return (v == pr[v] ? v : pr[v] = get(pr[v]));
}

bool uni(int u, int v)
{
    u = get(u), v = get(v);
    if (u == v)
    {
        return false;
    }
    pr[u] = v;
    return true;
}

class Main
{
public:
    void solve(std::istream &in, std::ostream &out)
    {
        int n;
        in >> n;
        vector<pair<pair<int, int>, int> > a;
        vector<pair<int, pair<int, int> > > w;
        for (int i = 0; i < n; i++)
        {
            pr[i] = i;
            int x, y;
            in >> x >> y;
            a.push_back({{x, y}, i});
        }
        sort(a.begin(), a.end());
        for (int i = 1; i < n; i++)
        {
            w.push_back({a[i].first.first - a[i - 1].first.first, {a[i].second, a[i - 1].second}});
        }
        for (auto &c : a)
        {
            swap(c.first.first, c.first.second);
        }
        sort(a.begin(), a.end());
        for (int i = 1; i < n; i++)
        {
            w.push_back({a[i].first.first - a[i - 1].first.first, {a[i].second, a[i - 1].second}});
        }
        sort(w.begin(), w.end());
        ll ans = 0;
        for (auto c : w)
        {
            int i = c.second.first, j = c.second.second;
            if (uni(i, j))
            {
                ans += c.first;
            }
        }
        out << ans << '\n';
    }
};


int main()
{
    ios::sync_with_stdio(0);
    Main solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 6388
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;
// const int MOD = 998244353;

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

   int n;
   cin >> n;
   vector<int> a(n);
   rep(i, 0, n) cin >> a[i];
   map<int, int> mp;
   ll ans = 0;
   rep(i, 0, n) {
      int diff = i - a[i];
      ans += mp[diff];
      int sum = a[i] + i;
      mp[sum]++;
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 21004
import java.math.BigDecimal

fun main(args: Array<String>) {
    var inputs = readInputLine().split(" ").map { it.toLong() }
    val w = inputs[0]
    val h = inputs[1]
    val x = inputs[2]
    val y = inputs[3]
    
    // 面積(2等分)
    val area = BigDecimal.valueOf(w).multiply(BigDecimal.valueOf(h)).divide(BigDecimal.valueOf(2))
    
    // (x, y)が長方形の中心の場合のみ2等分する直線が複数存在する
    if (x == w / 2 && w % 2 == 0L && y == h / 2 && h % 2 == 0L) {
        println("$area 1")
    } else {
        println("$area 0")
    }
}
 
fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 37908
import math


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])

    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


def is_prime(n):
    for d in range(2, math.floor(math.sqrt(n)) + 1):
        if n % d == 0:
            return False
    return True


N = int(input())
if N == 1:
    print(0)
elif is_prime(N):
    print(1)
else:
    res = 0
    for _, count in factorization(N):
        if count <= 2:
            res += 1
        else:
            i = 1
            while count - i >= 0:
                count -= i
                i += 1
            res += (i - 1)
    print(res)

Measured memory_bytes: 9480
const long long MOD = 1000000007;
#include <bits/stdc++.h>
using namespace std;using ll=int_fast64_t;using ld=long double;using pll=pair<ll,ll>;using pld=pair<ld,ld>;
const ll INF=1LL<<60;void solve();int main(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(10);solve();}
#define SELECTOR(_1,_2,_3,_4,SELECT,...) SELECT
#define rep(...) SELECTOR(__VA_ARGS__,_rep2,_rep1,_rep0)(__VA_ARGS__)
#define _rep0(i,n) for(ll i=0;i<n;++i)
#define _rep1(i,k,n) for(ll i=k;i<n;++i)
#define _rep2(i,k,n,d) for(ll i=k;d!=0&&d>0?i<n:i>n;i+=d)
template<class T> vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<class... Ts> auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<class T> inline bool chmax(T &a,const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a,const T &b){if(a>b){a=b; return 1;} return 0;}
template<class T> void contout(const T &v){for(auto it=v.begin();it!=v.end();++it,cout<<(it!=v.end()?" ":"\n"))cout<<*it;}

void solve(){
  ll n; cin>>n;
  auto A=make_v(n,n,(ll)0);
  rep(i,n)rep(j,n) cin>>A[i][j];
  ll N=1<<n;
  vector<ll> dp(N,0);
  dp[0]=1;
  rep(i,n){
    vector<ll> ndp(N,0);
    rep(mask,N){
      if(__builtin_popcount(mask)!=i) continue;
      rep(j,n){
        if(A[i][j]&&!((mask>>j)&1)){
          ndp[mask^(1<<j)]+=dp[mask];
          ndp[mask^(1<<j)]%=MOD;
        }
      }
    }
    dp=ndp;
  }
  cout<<dp[N-1]<<"\n";
}

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


int main() {
    string S;
    cin>>S;
    bool judge =false;
    rep(i,S.size()){
        if(i%2==0 && S[i]=='L'){
            judge =true;
            break;
        }
        else if(i%2!=0 && S[i]=='R'){
            judge =true;
            break;
        }
    }
    if(judge)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
package main

import (
  "fmt"
)

func maxInt(a ...int) int {m := a[0]; for _, x := range a {if x > m {m = x}}; return m}
func minInt(a ...int) int {m := a[0]; for _, x := range a {if x < m {m = x}}; return m}

func main() {
  var r, u, n int 
  l, d := 0, 0
  fmt.Scan(&r, &u, &n)
  for i := 0; i < n; i++ {
    var x, y, a int 
    fmt.Scan(&x, &y, &a)
    switch a {
    case 1: l = maxInt(l, x)
    case 2: r = minInt(r, x)
    case 3: d = maxInt(d, y)
    case 4: u = minInt(u, y)
    }
  }
  x := maxInt(r - l, 0)
  y := maxInt(u - d, 0)
  fmt.Println(y * x)
}

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

#ifdef DEBUG
#include "inc/debug.hpp"
#else
#define debug(...) 42
#endif

int main() {
    long long K, X;
    cin >> K >> X;
    if (K * 500 >= X) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/* ex3_2
   kohei0713 */

#include <stdio.h>

int main(void){
    
    int penNumber;
    
    //input
    scanf("%d", &penNumber);

    //penNumberの1の位を計算
    int onesPlace = penNumber % 10;

    //1の位によって場合分け
    if(onesPlace == 3){
        printf("bon\n");
    }else if(onesPlace == 0 || onesPlace == 1 || onesPlace == 6 || onesPlace == 8){
        printf("pon\n");
    }else{
        printf("hon\n");
    }

    return 0;
}

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

using namespace std;

int main() {
    int n,m; cin>>n>>m;
    vector<int> an(m+1,0);

    for (int i=0;i<n;i++) {
        int k; cin>>k;
        for (int j=0;j<k;j++) {
            int a; cin>>a;
            an[a]++;
        }
    }

    int ans=0;
    for (int i=1;i<=m;i++) {
        if (an[i]==n) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

long long sq(long long N){
  long long ret = 1;
  for(long long i = 1; i * i <= N; i++){
    if(N % i == 0){
      ret = i;
    }
  }
  return ret;
}

int dig(long long n){
  for(long long b = 1, up = 10; true; up *= 10, b++){
    if(n < up){
      return b;
    }
  }
}
 

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

  long long square = sq(N);

  cout << dig(N / square) << endl;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
    cin>>N;
  vector<int> vec(N);
for (int i = 0; i < N; i++) {
  cin >> vec.at(i);
}
  vector<int> ve=vec;
  sort(vec.begin(),vec.end());
  int j=0;
  while(j<N){
    if(ve.at(j)<=vec.at((N-1)/2)){
      cout<<vec.at((N+1)/2)<<endl;
      j++;
    }
    else {
      cout<<vec.at((N-1)/2)<<endl;
      j++;
    }
  }
}
  

Measured memory_bytes: 3712
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <vector>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;

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

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

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


int main() {
  string s;
  cin >> s;
  int ans = 0;
  int tmp = 0;
  int N = s.size();
  rep(i,N) {
    if(s[i] != 'A' && s[i] != 'G' && s[i] != 'T' && s[i] != 'C') {
      ans = max(tmp,ans);
      tmp = 0;
    }
    else tmp++;
    if(i == N-1) ans = max(tmp,ans);
    
  }
  cout << ans << endl;
  return 0;
}







Measured memory_bytes: 3132
n,k,s=map(int,input().split())
if s==10**9:
    for i in range(k):
        print(s,end=' ')
    for i in range(n-k):
        print(s-1,end=' ')
    exit()    
for i in range(k):
    print(s,end=' ')
for i in range(n-k):
    print(s+1,end=' ')

Measured memory_bytes: 48344
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
int main(void){
  string s;
  cin >> s;
  int b, e;
  for(int i = 0; i < s.size(); i++){
    if(s.at(i) == 'A'){
      b = i;
      break;
    }
  }
  for(int i = s.size()-1; i>=0; i--){
    if(s.at(i) == 'Z'){
      e = i;
      break;
    }
  }
  cout << e-b+1 << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
using namespace std;
const double EPS = 1e-6;
const double INF = 1e12;
const double PI = acos(-1);
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X) ? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}

double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b

}

double distanceLP(const L &l, const P &p) {
    return abs(cross(l[1]-l[0], p-l[0])) /abs(l[1]-l[0]);
}

VP convex(VP v){
    VP ret;
    int n = v.size();
    sort(v.begin(), v.end());
    for(int i=0; i<n; i++){
        while((int)ret.size()>1 && cross(ret.back()-ret[ret.size()-2], v[i]-ret.back()) < EPS){
            ret.pop_back();
        }
        ret.push_back(v[i]);
    }
    int t = ret.size();
    for(int i=n-2; i>=0; i--){
        while((int)ret.size()>t && cross(ret.back()-ret[ret.size()-2], v[i]-ret.back()) < EPS){
            ret.pop_back();
        }
        ret.push_back(v[i]);
    }
    if((int)ret.size() > 1) ret.pop_back();
    return ret;
}

double tri_search(const VP &c, int sp, int num){
    int n = c.size();
    int lb=sp, ub=sp+num;
    L base(c[sp], c[(sp+num)%n]);
    while(lb < ub){
        int mid = (lb +ub)/2;
        if(distanceLP(base, c[mid%n]) < distanceLP(base, c[(mid+1)%n])){
            lb = mid+1;
        }else{
            ub = mid;
        }
    }
    return distanceLP(base, c[lb%n]);
}

int main(){
    int n;
    cin >> n;
    VP p(n);
    for(int i=0; i<n; i++){
        int x,y;
        cin >> x >> y;
        p[i] = P(x, y);
    }

    VP c = convex(p);
    //凸包が三角形の場合はその頂点3つ+内部の1点
    if((int)c.size() == 3){
        double ans = 0;
        for(int i=0; i<n; i++){
            if(p[i]==c[0] || p[i]==c[1] || p[i]==c[2]) continue;
            for(int j=0; j<3; j++){
                L base(c[j], c[(j+1)%3]);
                double h = distanceLP(base, c[(j+2)%3]) -distanceLP(base, p[i]);
                ans = max(ans, abs(base[1] -base[0]) *h /2);
            }
        }
        cout << fixed << setprecision(1);
        cout << ans << endl;
        return 0;
    }

    //それ以外の場合は凸包上の4点(2点を決めて両側を3分探索)
    double ans = 0;
    n = c.size();
    for(int i=0; i<n; i++){
        for(int j=i+2; j<n; j++){
            double h1 = tri_search(c, i, j-i);
            double h2 = tri_search(c, j, n-(j-i));
            double blen = abs(c[i] -c[j]);
            ans = max(ans, blen *(h1 +h2) /2);
        }
    }
    cout << fixed << setprecision(1);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3428
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

int main(){
	int r;cin>>r;
	
	if(r<1200){
		cout<<"ABC"<<endl;
	}
	else if(r<2800){
		cout<<"ARC"<<endl;
	}
	else{
		cout<<"AGC"<<endl;
	}
	return 0;
}

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

using namespace std;

int main()
{int N; cin >> N;
      if( N >= 195){cout << 5;}
 else if( N >= 189){cout << 4;}
 else if( N >= 165){cout << 3;}
 else if( N >= 135){cout << 2;}
 else if( N >= 105){cout << 1;}
               else{cout << 0;}
 return 0;}
                    

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

int main(void) {
    int a, b, k;
    cin >> a >> b >> k;
    int c[2];
    c[0] = a, c[1] = b;
    for (int i = 0; i < k; i++) {
        int t = i & 1;
        if (c[t] & 1) {
            --c[t];
        }
        c[t] /= 2;
        c[(t + 1) & 1] += c[t];
    }
    printf("%d %d\n", c[0], c[1]);
}


Measured memory_bytes: 256
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
int main(){
	ll n,m,X=0,Y=hell;cin>>n>>m;
	for(int i=0;i<m;i++){
		ll x,y;cin>>x>>y;
		X=max(X,x);
		Y=min(Y,y);
	}
	cout<<max(Y-X+1,0LL);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  string S;
  int pin = 0;
  for (int i = 0; i < N; i++){
    cin >> S;
    if (S == "Y"){
      cout << "Four" << endl;
      pin = 1;
      break;
    }
  }
  if (pin == 0){
    cout << "Three" << endl;
  }
}
    


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define ignore ignore
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define bitcount(x)  __builtin_popcount(x)
#define bitcountll(x)  __builtin_popcountll(x)
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define inp(p) in2(p.F,p.S)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define prp(p) pr2(p.F,p.S)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define pinttwod(mat,i,j,n,m) rep(i,n){rep(j,m)pr(mat[i][j]);   lin;}
#define plltwod(mat,i,j,n,m)  rep(i,n){rep(j,m)llpr(mat[i][j]); lin;}
#define byes printf("YES\n")
#define bno printf("NO\n")
#define yes printf("Yes\n")
#define no printf("No\n")
#define lin printf("\n")
// Iterator
#define rep(i,n) for(i=0;i<n;++i)
#define rrep(i,n) for(i=n-1;i>=0;--i)
#define lp(i,a,b) for(i=a;i<b;++i)
#define rlp(i,a,b) for(i=a;i>=b;--i)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// function
#define sz(x) x.size()
#define inrange(i,a,b) (i>=a && i<=b)
#define FLUSH fflush(stdout)
#define precision(x) cout << setprecision(x) << fixed
#define remax(a,b) a=max(a,b)
#define remin(a,b) a=min(a,b)
#define bhardo(mat,i,j,n,m,t) rep(i,n){rep(j,m)mat[i][j]=t;}
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
// Constant
const double PI = acos(-1);
const double eps = (1e-9);
const ll INF = 1e18;
const int M = (1e9)+7;
const int N = (1e5)+5;  // check the limit, man
void solve()
{
    int n,i,temp,j;
    in(n);
    vi v(n);
    read(v,i,n);
    int ans=M;
    rep(i,101)
    {
        temp=0;
        rep(j,n)
            temp+=((i-v[j])*(i-v[j]));
        remin(ans,temp);
    }
    out(ans);
}
int main()
{
    int t;
    t=1;
    //in(t);
    while(t--)
        solve();
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<char> acgt = {'A','C','G','T'};
  string s;
  cin >> s;
  int count,work,max;
	 max = 0;
  for(int i = 0;i < s.size();i++){
    count = 0; work = 0;
    for(int j = i;j < s.size();j++){
      work = count;
      for(int h = 0;h < acgt.size();h++){
      if(s.at(j) == acgt.at(h)){
        count++;
      }else{
        continue;
      }
     }
      if(work == count){
        break;
      }
    }
    if(count > max){
       max = count;
    }
  }
    cout << max << endl;
    
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#define bogo_sort std::sort
#define bozo_sort std::stable_sort
#define alles(obj) obj.begin(), obj.end()
#define elif else if
#define unless(flg) if(!(flg))
#define elless(flg) else if(!(flg))
#define echo std::cout <<
#define read std::cin >>
#define endl std::endl
#define fin << '\n'
#define bash push_back
#define makePair std::make_pair
#define _ << ' ' <<
// type-define
#define Stack std::stack
#define Queue std::queue
#define Set std::set
#define PQueue std::priority_queue
#define Vector std::vector
#define Pair std::pair
#define Map std::map
#define HashMap std::unordered_map
#define Greater std::greater
using String = std::string;
using llong = long long;
using boolean = bool;
using Pii = Pair<int, int>;
using Vi = Vector<int>;
using Vii = Vector<Pii>;
// utils
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
constexpr int INF = 0x3f3f3f3f;
constexpr llong LINF = 0x3f3f3f3f3f3f3f3fLL;

namespace {
    template<class A, class B> A power ( llong x, llong n, llong mod ) {
        llong ans = 1;
        while ( n > 0 ) {
            if ( n & 1 ) ans = ( ans * x ) % mod;
            x = ( x * x ) % mod;
            n >>= 1;
        }
        return ans;
    }
    template<class A, class B> A power ( A x, B n ) { return power( x, n, 1000000007 ); }
    template<class A> A gcd ( A x, A y ) { return x % y ? gcd( y, x % y ) : y; }
    template<class A, class B> A lcm ( A x, B y ) { return ( x / gcd(x, y) * y ); }
    template<class A> inline A abs ( A n ) { return ( n < 0 ) ? -n : n; }
    template<class A, class B> inline bool chmax ( A &a, const B &b ) { return b > a ? a = b, true : false; }
    template<class A, class B> inline bool chmin ( A &a, const B &b ) { return b < a ? a = b, true : false; }
    boolean isMovable ( int x, int y, int w, int h ) {
        return ( x >= 0 && y >= 0 && x < w && y < h );
    }
}

namespace Rlyeh {

    int min = INF;
    int ans;

    signed call_of_Cthulhu( signed datum ) {

        int n, t;
        read n >> t;
        for ( int i = 0; i < n; i++ ) {
            int m, c;
            read c >> m;
            if ( m <= t ) chmin(min, c);
        }
        if ( min == INF ) {
            echo "TLE" fin;
        }
        else echo min fin;

        return 0;
    }
}
signed main(){std::cin.tie(0); std::ios::sync_with_stdio(false); int main_result = Rlyeh::call_of_Cthulhu(114514); return 0;}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v;
    for(int i=0;i<n;i++) {
        int b;
        cin >> b;
        if (b > (i+1)) {
            cout << -1 << endl;
            return 0;
        }
        // (b-1)番目にbを挿入
        auto it = v.begin();
        for(int j=0;j<(b-1);j++) {
            it++;
        }
        v.insert(it, b);
    }
    for(auto i: v) {
        cout << i << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//#define int long long
#define mod (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define mkp make_pair
#define mkt make_tuple
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

bool prime(int x) {
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0)return false;
	}
	return x > 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int mod_) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % mod_;
		}
		x = x * x % mod_;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x)* mod_pow(kai(x - y), mod - 2, mod) % mod * mod_pow(kai(y), mod - 2, mod) % mod;
}
/*--------Library Zone!--------*/

int n, m, c, a[25];
signed main() {
	cin >> n >> m >> c;
	rep(i, m)cin >> a[i];
	int ans = 0;
	rep(i, n) {
		int sum = c;
		rep(j, m) {
			int b; cin >> b;
			sum += b * a[j];
		}
		if (sum > 0)ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
import math
n, k = map(int, input().split())

ans = 0

for i in range(1,n+1):
      x = math.ceil(math.log2((k/i)))
      if x >= 1:
            ans += (1/n)*(1/2)**x
      else:
            ans += (1/n)
      #print(math.log2((k/i)))
print(ans)

Measured memory_bytes: 3188