akhauriyash/Code-Regression huggingface dataset:
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TemplateAlgorithm
{
    class Program
    {
        public const long Inf = (long)1e18;
        public const double eps = 1e-6;
        public const string alfa = "abcdefghijklmnopqrstuvwxyz";
        public const string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const int MOD = 1000000007;
        
        // c ot i
        static int ToInt(char c) => c - '0';

        static void Main(string[] args)
        {            
            int[] data = IO.ReadIntArr();
            int N, M, X, Y;
            N = data[0];
            M = data[1];
            X = data[2];
            Y = data[3];

            var xi = IO.ReadIntArr();
            var yi = IO.ReadIntArr();
            
            for (var z = X + 1; z <= Y; z++)
            {                
                if (X < z && z <= Y)
                {
                    if (xi.All(x => x < z) && yi.All(y => y >= z))
                    {
                        WriteLine("No War");
                        return;
                    }
                }                
            }
            WriteLine("War");            
        }

        #region  範囲

        public static bool InRange<T>(T begin, T end, T value) where T : IComparable<T> 
            => value.CompareTo(begin) >= 0 && value.CompareTo(end) <= 0;

        #endregion

        #region MIN,MAX

        /// <summary>
        /// 最大値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MaxValue<T>(params T[] vals) => vals.Max();

        /// <summary>
        /// 最小値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MinValue<T>(params T[] vals) => vals.Min();
        #endregion
    }

    #region IO

    /// <summary>
    /// IO
    /// </summary>
    public class IO
    {
        public static string ReadStr(bool isTrim = false) => (isTrim) ? ReadLine().Trim() : ReadLine();
        public static int ReadInt() => int.Parse(ReadStr());

        public static long ReadLong() => long.Parse(ReadStr());

        public static decimal ReadDecimal() => decimal.Parse(ReadStr());
        public static double ReadDouble() => double.Parse(ReadStr());
        public static string[] ReadStrArr(char separator = ' ') => ReadLine().Split(separator);
        public static int[] ReadIntArr() => Array.ConvertAll(ReadStrArr(), int.Parse);
        public static long[] ReadLongArr() => Array.ConvertAll(ReadStrArr(), long.Parse);

        public static decimal[] ReadDecimalArr() => Array.ConvertAll(ReadStrArr(), decimal.Parse);
        public static double[] ReadDoubleArr() => Array.ConvertAll(ReadStrArr(), double.Parse);        
    }

    #endregion    
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
using ld = long double;
const ll ATCODER_AMARI = 1000000007; //10^9 + 7
const ll INF = 10000000000000;

//階乗関数　ATCODER_AMARIに注意
ll factorial(ll k){
  ll sum = 1;
  for(int i = 1 ; i < k + 1; i++) {
    sum *= i;
    //sum = sum % ATCODER_AMARI;
  }
  return sum;
}

int main() {
  int n;
  cin >> n;
  map<string,int> count;

  rep(i,n) {
    string s;
    cin >> s;
    count[s]++;
  }

  cout << "AC x " << count["AC"] << endl;
  cout << "WA x " << count["WA"] << endl;
  cout << "TLE x " << count["TLE"] << endl;
  cout << "RE x " << count["RE"] << endl;
  
}


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

int linear_random(int A, int B, int C, int x);

int main(int argc, char const* argv[])
{
  while (true) {
    int N, A, B, C, X;
    std::cin >> N >> A >> B >> C >> X;
    if (N == 0 && A == 0 && B == 0 && C == 0 && X == 0)
      break;
    std::vector<int> reels(N);
    for (int i = 0; i < N; ++i)
      std::cin >> reels[i];
    int frame = 0;
    int random = X;
    int i = 0;
    while (i < N) {
      if (reels[i] == random) {
        ++i;
        if (i == N)
          break;
      }
      random = linear_random(A, B, C, random);
      ++frame;
      if (frame > 10000)
        goto fail;
    }
    std::cout << frame << std::endl;
    continue;
fail:
    std::cout << -1 << std::endl;
  }
  return 0;
}

int linear_random(int A, int B, int C, int x) {
  return (A * x + B) % C;
}

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

int main()
{ 
  int n;

  cin >> n;
  for (int i = 1; i <= 9; i++)
  {
    if (n <= 111 * i)
    {
      cout << 111 * i << endl;
      break;
    }
  }
}

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

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

	int n;
	cin >> n;
	map<char, int> mn;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;

		map<char, int> cur;
		for (auto& c : s) {
			++cur[c];
		}

		if (!i) {
			mn = cur;
		} else {
			for (char c = 'a'; c <= 'z'; ++c) {
				mn[c] = min(mn[c], cur[c]);
			}
		}
	}

	for (char c = 'a'; c <= 'z'; ++c) {
		while (mn[c] > 0) {
			cout << c;
			--mn[c];
		}
	}

	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>

using namespace std;

int main(void) {
	int N, K;
	scanf("%d %d", &N, &K);
	if (N%K == 0) {
		printf("0\n");
	}
	else {
		printf("1\n");
	}
}









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

int main() {
	int a,b,c;
	cin>>a>>b>>c;
	if(a<b){
		if(b<c){
	                        cout<<a<<" "<<b<<" "<<c<<endl;
		}else if(a<c){
			cout<<a<<" "<<c<<" "<<b<<endl;
		}else{
			cout<<c<<" "<<a<<" "<<b<<endl;
		}
	}else{
		if(a<c){
		            cout<<b<<" "<<a<<" "<<c<<endl;
		}else if(b>c){
			cout<<c<<" "<<b<<" "<<a<<endl;
		}else{
			cout<<b<<" "<<c<<" "<<a<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 3080
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int w = s.nextInt();
		int h = s.nextInt();
		int n = s.nextInt();

		int x1 = 0;
		int x2 = w;
		int y1 = 0;
		int y2 = h;

		int i = 0;

		for (i = 0; i < n; i++) {
			int x = s.nextInt();
			int y = s.nextInt();
			int a = s.nextInt();

			if (a == 1) {
				if (x1 > x) {
					x1 = x1;
				} else if (x1 <= x) {
					x1 = x;
				}

			} else if (a == 2) {
				if (x2 < x) {
					x2 = x2;
				} else if (x2 >= x) {

					x2 = x;
				}

			} else if (a == 3) {
				if (y1 > y) {
					y1 = y1;
				} else if (y1 <= y) {
					y1 = y;
				}

			} else if (a == 4) {
				if (y2 < y) {
					y2 = y2;
				} else if (y2 > y) {
					y2 = y;
				}

			}

		}
		if (x2 > x1 && y2 > y1) {
			System.out.println((x2 - x1) * (y2 - y1));

		} else {
			System.out.println("0");
		}

	}

}

Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <stack>
#include <map>
#include <iomanip>
using namespace std;

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

const int MAX = 510000;
const int MOD = 1000000007;

int64_t fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
    int x,n ;
    cin >> x >> n ;
    vector<int> p(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> p.at(i) ;
    }
    bool flag = true ;
    for (size_t i = 0; i < n; i++)
    {
        if (x == p.at(i))
        {
            flag = false ;
            break ;
        }
        
    }
    if (flag == true)
    {
        cout << x << endl ;
        return 0 ;
    }
    int e = 1 ;
    while (1)
    {
        flag = 1 ;
        for (size_t i = 0; i < n; i++)
        {
            if (x - e == p.at(i))
            {
                flag = 0 ;
                break ;
            }
        }
        if (flag == 1)
        {
            cout << x - e << endl ; ;
            return 0 ;
        }
        flag = 1 ;
        for (size_t i = 0; i < n; i++)
        {
            if (x + e == p.at(i))
            {
                flag = 0 ;
                break ;
            }
        }
        if (flag == 1)
        {
            cout << x + e << endl ;
            return 0 ;
        }
        
        e++ ;
    }
    
}

Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(void) {
	int N;
	cin >> N;

	if (N == 1) {
		cout << "Hello World" << endl;
	}
	else if (N == 2) {
		int A, B;
		cin >> A >> B;
		cout << A + B << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int main(){
    int n;
    cin>>n;
    vector<int> d(n);
    for(int i=0; i<n; i++){
        cin>>d.at(i);
    }
    long long ans =0; 
    for(int i=0; i<n-1; i++){
        for(int j=i+1; j<n; j++){
            ans += d.at(i)*d.at(j);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(a) (a).size()
#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define forn(i, n) for (int i = 1; i <= n; i++)
#define ford(i, n) for (int i = n; i >= 0; i--)
#define REP(i, a, n) for (int i = a; i < n; i++)
#define foreach(itr, c) for (__typeof((c).begin(), (c).end()) itr = c.begin(); itr != c.end(); itr++)
#define fill(a, b) memset(a, b, sizeof(a))
#define re return
#define INF 1e9
#define LINF 1e18
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<char> vs;
typedef vector<pi> vpi;

using namespace std;

int main()
{
    int n = 3;
    int count = 0;
    int max = 0;

    vs S(n);

    rep(i, n)
    {
        cin >> S[i];

        if (i == 0)
        {
            if (S[i] == 'R')
            {
                count++;
                max = 1;
            }
        }
        else
        {
            if (S[i] == 'R')
            {
                count++;
                if (max < count)
                {
                    max = count;
                }
            }
            else
            {
                count = 0;
            }
        }
    }

    cout << max;
}

Measured memory_bytes: 3616
from fractions import gcd
#from math import gcd
N,M = map(int,input().split())
A = list(map(int,input().split()))
lcm = A[0]
lis = [[0] for _ in range(30)]
tmp = 0
while A[0]%2 == 0:
    A[0]//= 2
    tmp += 1
lis[tmp] = 1

for i in range(1,N):
    tmp = 0
    while A[i]%2 == 0:
        A[i]//= 2
        tmp += 1
    lis[tmp] = 1
    lcm = (lcm*A[i]) // gcd(lcm,A[i])
    if lcm > 2*M:
        print(0)
        exit()
jud = False
for l in lis:
    if l == 1:
        if jud == True:
            print(0)
            exit()
        else:
            jud = True


M -= lcm//2
ans = (M//lcm)+1
print(ans)


Measured memory_bytes: 16320
#include<iostream>
#include<set>
using namespace std;
int n;
main()
{
    cin>>n;
    multiset<int> s;
    for(int i=0;i<n;i++)s.insert(-1);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int a;cin>>a;
        multiset<int>::iterator it=s.lower_bound(a);
        it--;
        if(*it==-1)ans++;
        s.erase(it);
        s.insert(a);
    }
    cout<<ans<<endl;
}

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

int main (){
  int A,B,C,K;
  cin >> A >> B >> C >> K;
  if (K <=A){
    cout << K << endl;
  }
  if (K > A && K <= A+B){
    cout << A << endl;
  }
  if ( K > A+B ){
    cout << 2*A+B-K << endl;
  }
}

Measured memory_bytes: 3620
A, B, M = map(int,input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))

x = list()
y = list()
c = list()
for i in range(M):
    xi, yi, ci = map(int,input().split())
    x.append(xi)
    y.append(yi)
    c.append(ci)

p = list()

amin = min(a)
bmin = min(b)
pab  = amin + bmin
p.append(pab)
        
for i in range(M):
    pi = a[x[i]-1] + b[y[i]-1] - c[i]
    p.append(pi)

print(min(p))


Measured memory_bytes: 27820
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;

int main(){
  ll n,k;cin>>n>>k;
  if(k==1)cout<<0<<endl;
  else cout<<n-k<<endl;
  return 0;
}


Measured memory_bytes: 256
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    k,x=INTM()
    ans=[]
    a=max(-1000000, x-k+1)
    b=min(1000000, x+k-1)
    for i in range(a,b+1):
        ans.append(i)
    print(*ans)
if __name__ == '__main__':
    do()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
const int INF = 1<<29;
const ll LNF = 1LL<<60;

int main(){
    int N,K; cin >> N >> K;
    vector<ll> h(N);
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    vector<ll> dp(N+1,LNF);
    dp[0]=0;
    for(int i=1;i<N;i++){
        for(int j=1;j<=K;j++){
            if(i-j>=0){
                dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
            }
        }
    }
    cout << dp[N-1] << endl;
    return 0;
}


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

int main() {
  int k;
  string s;
  cin >> k >> s;

  if (s.size() <= k) {
    cout << s << endl;
  } else {
    cout << s.substr(0, k) << "..." << endl;
  }

  return 0;
}


Measured memory_bytes: 3628
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

int main() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, 0, n) {
    string s;
    cin >> s;
    mp[s]++;
  }

  int mx = 0;
  for (auto kv : mp) mx = max(mx, kv.second);

  set<string> st;
  for (auto kv : mp)

    if (kv.second == mx) st.insert(kv.first);

  for (string s : st) cout << s << '\n';
  return 0;
}

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

using namespace std;

constexpr int MAX_N = 100000;
constexpr int INF = (1 << 29);

int N, M, w[MAX_N], point;
bool visited[MAX_N], used[MAX_N];
vector<int> G[MAX_N];

bool dfs(int curr, int prev)
{
    if (visited[curr]) return 1;
    visited[curr] = 1;
    
    bool reach = 0;
    for (int next : G[curr]) {
        if (next == prev) continue;                
        reach |= dfs(next, curr);
    }

    if (reach) {
        used[curr] = 1;
        point += w[curr];
    }
    return reach;
}

int main()
{
    scanf("%d %d", &N, &M);
    for (int i = 0; i < N; i++) {
        scanf("%d", &w[i]);
    }

    for (int i = 0; i < M; i++) {
        int u, v;
        scanf("%d %d", &u, &v);
        u--; v--;
        G[u].emplace_back(v);
        G[v].emplace_back(u);
    }
    
    dfs(0, -1);
    
    using pii = pair<int, int>;
    priority_queue<pii> pq;
    pq.push(pii(0, 0));
    
    vector<int> d(N, -1);
    d[0] = 0;
    
    while (!pq.empty()) {
        pii p = pq.top(); pq.pop();
        int cost, curr;
        tie(cost, curr) = p;

        if (cost < d[curr]) continue;
        for (int next : G[curr]) {
            if (d[next] != -1) continue;
            
            d[next] = cost + (used[next] ? 0 : w[next]);
            pq.push(pii(d[next], next));
        }
    }
    
    point += *max_element(d.begin(), d.end());
    printf("%d\n", point + (!used[0] ? w[0] : 0));
    return 0;
}

Measured memory_bytes: 15528
#include <iostream>
using namespace std;
int main(){
  string s;cin>>s;
  string t;cin>>t;
  string ss = s+s;
  for(int i = 0; s.size() > i; i++){
    bool ok = true;
    for(int j = 0; t.size() > j; j++){
      if(t[j] != ss[i+j]){
        ok = false;
        break;
      }
    }
    if(ok){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
#define pb push_back
#define eb emplace_back
using ll=long long;
using P = pair<ll,ll>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
const ll MOD=1000000007,MOD2=998244353;



int main() {
    ll N,Q;
    cin>>N>>Q;
    vector<pair<ll,ll>> nginout;
    rep(i,N){
        ll S,T,X;
        cin>>S>>T>>X;
        P in,out;
        in.first=S-X;
        in.second=-X;
        out.first=T-X-1;
        out.second=X;
        nginout.pb(in);
        nginout.pb(out);
    }
    vector<ll> D(Q);
    rep(i,Q){
        cin>>D.at(i);
    }
    vector<ll> ans(Q);
    set<ll> ng;
    sort(nginout.begin(),nginout.end());
    ll point=0;
/*rep(i,2*N){
    cout<<"("<<nginout.at(i).first<<","<<nginout.at(i).second<<")";
}
cout<<endl;*/
    
    rep(i,Q){
        while(point<2*N && nginout.at(point).first<=D.at(i)){
            if(nginout.at(point).first==D.at(i) && nginout.at(point).second>0){
                break;
            }
            if(nginout.at(point).second<0){
                ng.insert(-nginout.at(point).second);
            }
            else{
                ng.erase(nginout.at(point).second);
            }
            point++;
        }
        
        if(ng.empty()){ans.at(i)=-1;continue;}
        ans.at(i)=*begin(ng);
    }
    rep(i,Q){
        cout<<ans.at(i)<<endl;
    }
}

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

#define ENGZ ios::sync_with_stdio(0);cin.tie(0);ios_base::sync_with_stdio(0);
#define sfi(x) scanf("%d" , &x)
#define sfi2(x, y) scanf("%d%d" , &x,&y)
#define sfl2(x, y) scanf("%I64d%I64d" , &x,&y)
#define sfl(x) scanf("%I64d" , &x)
#define sfl3(x, y, z) scanf("%I64d%I64d%I64d", &x, &y, &z)
#define sfd(x) scanf("%lf", &x)
#define sfd2(x, y) scanf("%lf", &x, &y)
#define sfs(x) scanf("%s", &x)
#define testv(x) cerr << x << ' '
#define wtf(s) freopen((s), "w", stdout)
#define rff(s) freopen((s), "r", stdin)
#define test cerr << "here"
#define fst(x) cout << fixed << setprecision(x)
#define mod 1000000007
#define pi (2 * acos(0))
typedef long double ld;
typedef long long ll;
int main()
{
    ll n, m, a = 1, b = 1;
    cin >> n >> m;
    for (ll i = 1; i <= n; i++)
        a = (a * i) % mod;
    for (ll i = 1; i <= m; i++)
        b = (b * i) % mod;
    if (abs(n - m) >= 2)
        cout << 0;
    else if (m == n)
        cout << (((a * b) % mod) * 2) % mod;
    else
        cout << (a * b) % mod;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	//while(1)
	{
		int n;
		cin>>n;
		long long sum=0;
		int ma = -1000;
		for(int i=0;i<n;i++)
		{
			int a;
			cin>>a;
			sum+=a;
			ma = max(ma,a);
		}
		sum-=ma;
		if(ma<sum)
		{
			cout<<"Yes\n";
		}
		else
		{
			cout<<"No\n";
		}
	}
 } 

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 20:59:38 2020

@author: NEC-PCuser
"""

X = int(input())

if X <= 599:
    print(8)
elif X <= 799:
    print(7)
elif X <= 999:
    print(6)
elif X <= 1199:
    print(5)
elif X <= 1399:
    print(4)
elif X <= 1599:
    print(3)
elif X <= 1799:
    print(2)
else:
    print(1)

Measured memory_bytes: 9176
def is_integer(n):
    try:
        float(n)
    except ValueError:
        return False
    else:
        return float(n).is_integer()

a,b,k=map(int,input().split())
ans=[]
for i in range(a):
  if is_integer(a/(i+1))==True and is_integer(b/(i+1))==True:
    ans.append(i+1)
    
ans.reverse()
print(ans[k-1])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef complex<double> P;
double eps=1e-8;
struct S{
  P s,t;
  S(P s=P(),P t=P()): s(s),t(t) {}
};
struct C{
  P p;
  double r;
  C(P p=P(),double r=0):p(p),r(r){}
};
 
 
bool eq(double a,double b){
  return (-eps<a-b&&a-b<eps);
}
 
double Sqrt(double a){
  if(a<0)return 0;
  return sqrt(a);
}

bool isIntersect(C a,C b){
  double k=abs(a.p-b.p);
  return (a.r+b.r>=k-eps&& abs(a.r-b.r)<=k+eps);
}

P crossPoint(C a,C b){
  P base=b.p-a.p;
  double k=(-b.r*b.r+a.r*a.r+norm(base));
  double w=k/(2.0*abs(base)),h=Sqrt(a.r*a.r-w*w);
  base/=abs(base);
  return a.p+base*P(w,h);
}


bool isIntersect(vector<C> &vec){
  vector<P> t;
  for(int i=0;i<(int)vec.size();i++){
    t.push_back(vec[i].p);
    for(int j=0;j<i;j++){
      if(isIntersect(vec[i],vec[j])){
        t.push_back(crossPoint(vec[i],vec[j]));
        t.push_back(crossPoint(vec[j],vec[i]));
      }
    }
  }
  for(int i=0;i<(int)t.size();i++){
    bool flg=true;
    for(int j=0;j<(int)vec.size();j++)
      if(vec[j].r*vec[j].r+eps<norm(vec[j].p-t[i]))flg=false;
    if(flg)return true;
  }
  return false;
}

int n;
vector<P> t;
vector<double> u;

double check(double M){
  vector<C> nt(n);
  for(int i=0;i<n;i++){
    nt[i].p=t[i];
    nt[i].r=Sqrt(u[i]*u[i]-M*M);
  }
  return isIntersect(nt);
}

double solve(){
  double L=0,R=1e8,M;
  for(int i=0;i<n;i++)R=min(R,u[i]);
  
  for(int i=0;i<1000;i++){
    M=(L+R)/2;
    if(check(M))L=M;
    else R=M;
  }
  
  return L;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    t.clear();t.resize(n);
    u.clear();u.resize(n);
    for(int i=0;i<n;i++){
      double x,y;
      cin>>x>>y>>u[i];
      t[i]=P(x,y);
    }
    printf("%.10f\n",solve());
  }
}

Measured memory_bytes: 1280
n = int(input())
a = list(map(int,input().split()))
a = [0] + a + [0]
s = 0
for i in range(n+1):
    s += abs(a[i]-a[i+1])
#print(s)
for i in range(1,n+1):
    print(s+abs(a[i-1]-a[i+1])-(abs(a[i-1]-a[i])+abs(a[i]-a[i+1])))

Measured memory_bytes: 14044
n = gets.chomp.to_i
points = []
route = 1
n.times do |num|
  x, y = gets.chomp.split.map(&:to_f)
  points << [x + 1000, y + 10000]
  route *= num + 1
end

streets = route * (n - 1)
street_pattern = n * (n -1) / 2

all_length = 0
for i in 0..(n - 1) do
  for j in i..(n - 1) do
    all_length += Math.sqrt((points[i][0] - points[j][0]) ** 2 + (points[i][1] - points[j][1]) ** 2) * (streets / street_pattern)
  end
end
puts all_length / route

Measured memory_bytes: 3836
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int main()
{
    int x,a;
    cin>>x>>a;
    if(x<a)puts("0");
    else puts("10");
    return 0;
}

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

int main() {
  vector<int> vec(3);
  for(int i=0;i<3;i++){
    cin>>vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int a=vec.at(0),b=vec.at(1),c=vec.at(2);
  int answer=0;
  
  if(a==c){
    cout<<answer<<endl;
    return 0;
  }
  
  if(a!=b&&b!=c){
    answer+=c-b;
    if((b-a)%2==0){
      answer+=(b-a)/2;
    }
    else{
      answer+=(b-a)/2+2;
    }
    cout<<answer<<endl;
    return 0;
  }
  
  if(a==b&&b!=c){
    cout<<c-b<<endl;
    return 0;
  }
  
  if((b-a)%2==0){
    cout<<(b-a)/2<<endl;
    return 0;
  }
  cout<<(b-a)/2+2<<endl;
}

Measured memory_bytes: 256
# c
require 'pp'
x, k = gets.split.map(&:to_i)

# x >>> k
if x > k

  x2 = x % k

  if x2 == 0
    p 0
    exit
  end

  # x2 < k
  x3 = k % x2
  p x3
else # x <= k
  if k - x > x
    p x
  else
    x2 = k - x
    p x2
  end
end

# 1 2 0









Measured memory_bytes: 2044
#!/usr/bin/env python3
import sys
from collections import Counter

def main():
    N = int(input())
    a = list(map(int, input().split()))
    l = Counter(a)
    if len(l)==1 and 0 in l:
        print('Yes')
        exit()
    if N%3==0 and len(l)==2 and 0 in l and l[0] == N//3:
        print('Yes')
        exit()
    if N%3==0 and len(l)==3:
        x,y,z = l.keys()
        if l[x] == l[y] == N//3 and x^y^z == 0:
            print('Yes')
            exit()
    print('No')

if __name__ == '__main__':
    main()

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

int main() {
  long n,m,ans=0;
  cin >> n >> m;
  for(long i=1;i*i<=m;i++) {
    if(m%i==0) {
      if(m/i>=n) ans=max(ans,i);
      if(i>=n) ans=max(ans,m/i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int all;
	int b[9];
	int i;
	int sum;
	
	while (1) {
		sum = 0;
		scanf("%d", &all);
		if (all == 0) {
			break;
		}
		for (i = 0; i < 9; i++) {
			scanf("%d", &b[i]);
			sum += b[i];
		}
		printf("%d\n", all - sum);
	}
	return (0);
}

Measured memory_bytes: 600
#include <stdio.h>

int main()
{
  int a, b, c;
  
  scanf("%d %d %d", &a, &b, &c);
  
  if (a == b) {
    if (c != a) {
      printf("Yes");
      return 0;
    }
  } else if (b == c) {
    if (a != b) {
      printf("Yes");
      return 0;
    }
  } else if (a == c) {
    if (b != a) {
      printf("Yes");
      return 0;
    }
  }
  
  printf("No");
  
  return 0;
}

Measured memory_bytes: 1660
#include <bits/stdc++.h>
using namespace std;
#define N 1000000000

int main() {
    int city[4]={};
    int n;
    for(int i=0;i<6;i++){
        cin >> n;
        city[n-1]++;
    }
    for(int i=0;i<4;i++){
        if(city[i]>2){
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    map<string,long long> m;
    for (int i=0;i<N;++i){
        string S; cin >> S;
        sort(S.begin(),S.end());
        ++m[S];
    }
    long long ans=0;
    for (auto x:m){
        long long a=x.second;
        ans+=a*(a-1)/2;
    }
    cout << ans << endl;
}

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


int main(){
  string s;
  cin >> s;
  bool ok = true;
  for(int i = 1; i <= s.length(); i++){
    if(i%2 != 0){
      if(s[i-1] == 'L')ok = false;
    }else{
      if(s[i-1] == 'R')ok = false;
    }
  }
  if(ok)puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int,  int>;
using pll = pair<ll, ll>;
using edge = pair<int, ll>;
using Graph = vector<vector<int>>; 
using WeightedGraph = vector<vector<edge>>;
const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

ll dp[50][500][500];
int main(){
  int n, ma, mb;
  cin >> n >> ma >> mb;
  vector<int> a(n), b(n), c(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i] >> b[i] >> c[i];
  }
  int M= 400;
  
  for(int i = 0; i <= n; ++i){
    for(int j = 0; j < 500; ++j){
      for(int k = 0; k < 500; ++k){
        dp[i][j][k] = INF;
      }
    }
  }
  
  dp[0][0][0]= 0;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j <= M; ++j){
      for(int k = 0; k <= M; ++k){
        dp[i+1][j+a[i]][k+b[i]] = min(dp[i+1][j+a[i]][k+b[i]], dp[i][j][k]+c[i]);
        dp[i+1][j][k]= min(dp[i+1][j][k], dp[i][j][k]);
      }
    }
  }
  ll ans = INF;
  for(int i = 1; i <= 41; ++i){
    //cout << dp[n][ma*i][mb*i] << endl;
    ans = min(ans, dp[n][ma*i][mb*i]);
  }
  if(ans == INF) ans = -1;
  cout << ans << endl;
}


Measured memory_bytes: 82176
#include<bits/stdc++.h>
using namespace std;
#define int long long

#define inf 1000000005

int32_t main() {

    int n;
    cin >> n;
    int h[n];
    for (int i=0; i<n; ++i) {
		
		cin >> h[i];
		
	}
	
	int dp[n];
	memset (dp, inf, sizeof(dp));
	
	dp[0] = 0;
	for (int i=0; i<n-1; ++i) {
		
		dp[i+1] = min (dp[i+1], dp[i] + abs (h[i+1] - h[i]));
		if (i+2<n)
			dp[i+2] = min (dp[i+2], dp[i] + abs (h[i+2] - h[i]));
		
	}

		cout << dp[n-1] << endl;
	
	
	     return 0;

}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll a, b, m;
    cin >> a >> b >> m;
    vector<ll> A(a), B(b);
    REP(i, a) cin >> A[i];
    REP(i, b) cin >> B[i];
    ll ret = INF;
    REP(i, m) {
        ll x, y, c;
        cin >> x >> y >> c;
        x--, y--;
        chmin(ret, A[x]+B[y]-c);
    }

    ll mia = INF, mib = INF;
    REP(i, a) chmin(mia, A[i]);
    REP(i, b) chmin(mib, B[i]);
    chmin(ret, mia+mib);

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <array>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>
#include <stack>
#include <utility>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <bitset>
#include <random>
#include <functional>
#include <sstream>
#include <iomanip>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); i++)
#define FOR(i, m, n) for(int i=(m);i<(n);i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define REVE(x) reverse((x).begin(),(x).end())
#define mp make_pair
#define pb push_back

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef long long LL;

int main() {
	int a1, a2, a3, a4, b1, b2, b3, b4;
	while (cin >> a1 >> a2 >> a3 >> a4 >> b1 >> b2 >> b3 >> b4) {
		VI a = { a1,a2,a3,a4 };
		VI b = { b1,b2,b3,b4 };

		int c1 = 0, c2 = 0;
		rep(i, 4) {
			if (a[i] == b[i])c1++;
		}

		VI ca(10), cb(10);
		rep(i, 4)ca[a[i]]++;
		rep(i, 4)cb[b[i]]++;
		rep(i, 10) {
			c2 += min(ca[i], cb[i]);
		}

		cout << c1 << " " << c2 - c1 << endl;
	}
}


Measured memory_bytes: 3088
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    if(N[0] == '9' || N[1] == '9'){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3596
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int count = 0;
        int max = 0;
        for(int i = 0; i < a; i++){
            int height = sc.nextInt();
            if(max <= height){
                count++;
                max = height;
            }
                
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;

map<int,int> M;
int main(){
    int n;
    cin >> n;
    int ans=0;
    for(int i=1;i<=n;++i){
        int a;
        scanf("%d",&a);
        ++M[a];
    }
    auto it=M.begin();
    while(it!=M.end()){
        int val=(*it).first;
        int coun=(*it).second;
        if(val>coun){
            ans+=coun;
        }
        else{
            ans+=(coun-val);
        }
        ++it;
    }
    cout << ans << endl;
    return 0;

}


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

int main() {
  
  string b;
  cin >> b;
  
  if (b == "A") {
    cout << "T" << endl;
  }
  else if (b == "T") {
    cout << "A" << endl;
  }
  else if (b == "G") {
    cout << "C" << endl;
  }
  else {
    cout << "G" << endl;
  }
}
    


Measured memory_bytes: 256
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        int n=ni();
        BigInteger prod=BigInteger.ONE;
        long[]A=nal(n);
        Arrays.sort(A);
        for(int i=0;i<n;i++)
        {
            String s=Long.toString(A[i]);
            prod=prod.multiply(new BigInteger(s));
            if(prod.compareTo(new BigInteger(Long.toString((long)1e18)))>0)
            {
                pn("-1");
                return;
            }
        }
        pn(prod);
    }

    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj =true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

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

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}


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

int main() {
  string s; cin >> s;
  int siz = s.size();

  string first1,first0;
  rep(i,siz){
    if(i%2 == 0){
      first1.push_back('1');
      first0.push_back('0');
    }
    if(i%2 == 1){
      first1.push_back('0');
      first0.push_back('1');
    }
  }

  //cout << first1 <<" "<<first0;

  int cnt1=0, cnt0=0;
  rep(i,siz){
    if(s[i] == first1[i]) cnt1++;
    if(s[i] == first0[i]) cnt0++;
  }

  cout << min(cnt1,cnt0) << endl;
}


Measured memory_bytes: 768
n=int(input())

fact=[True]*55556
fact[0]=False
fact[1]=False
ans=[]
for i in range(2,len(fact)):
  if fact[i]:
    if i%5==1:
      ans+=[i]
      if len(ans)==n:
        print(*ans)
        break
    for j in range(i*2,len(fact),i):
      fact[j]=False


Measured memory_bytes: 3444
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	char s[10],c[10];
	int n,cnt,len,flg;
	int i,j,k,l;
	scanf("%s",s);
	scanf("%d",&n);
	len=strlen(s);
	cnt=0;
	for(i=0;i<n;i++){
		scanf("%s",c);
		flg=0;
		for(j=0;j<10;j++){
			// printf("c[j]=%c s[0]=%c\n",c[j],s[0]);
			if(c[j]==s[0]){
				// printf("coming\n");
				flg=1;
				k=j;
				l=0;
				while(1){
					if(k==10)	k=0;
					if(len==l)	break;
					if(c[k]==s[l]){
						l++;
					}
					else{
						flg=0;
						break;
					}
					k++;
				}
				if(flg==1){
					// printf("i=%d\n",i);
					cnt++;
				}
			}
			if(flg==1){
				break;
			}
		}
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 2748
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<functional>
#include<cmath>
#include<set>
#include<random>
#include<map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 11451419198109130;
typedef pair<int, int> P;
struct edge { int to, cost; };
int a[50000], b[50000], p[50000];
signed main() {
	int n; cin >> n;
	rep(i, n)cin >> p[i];
	a[0] = 10;
	b[0] = 990000000;
	rep(i, n) {
		a[i] = a[0] + 30000 * i;
		b[i] = b[0] - i * 30000;
	}
	rep(i, n) {
		b[p[i] - 1] += i;
	}
	rep(i, n) {
		if (i)cout << ' '; cout << a[i];
	}cout << endl;
	rep(i, n) {
		if (i)cout << ' '; cout << b[i];
	}
	cout << endl;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
#include <iostream>
typedef long long ll;
#define rep(i,a,b) for(ll i =a ;i <= b;i++)
using namespace std;


int main(int argc, char const *argv[])
{
	//ifstream cin("input.txt");
	
	ll n;
	cin>>n;
	string s;
	while(n--)
	{
		char rem = (n%26) + 'a';
		s.push_back(rem);
		n = n/26;
	}
	reverse(s.begin(), s.end());
	cout<<s;

}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <numeric>
using namespace std;

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

	vector<int> score;
	
	for (int i = 0; i < n; i++)
	{
		int p;
		cin >> p;
		score.push_back(p);
	}

	sort(score.begin(), score.end(), greater<int>());
	
	long long sum = accumulate(score.begin(), score.end(), 0);

	double border = double(sum) / double(4.0 * double(m));

	if (score[m-1] >= border)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<climits>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<list>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<utility>
#include<vector>
 
#define lint long long
#define VI vector<int>
#define VL vector<lint>
#define VB vector<bool>
#define VC vector<char>
#define VS vector<string>
#define VVI vector<VI>
#define VVL vector<VL>
#define rep(i, n) for(int i = 0 ; i < n ; i++)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; i--)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX

using namespace std;

lint gcd(lint x, lint y){
    lint r = x % y;
    while(r != 0){
        x = y;
        y = r;
        r = x % y;
    }
    return y;
}

lint lcm(lint x, lint y){
    return x / gcd(x, y) * y;
}

int main(){
    int n;
    cin >> n;
    lint ans = 0;
    rep(i, n){
        lint a;
        cin >> a;
        ans += (a-1);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
namespace B___Buffet
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Trim().Split(' ').Select(s => int.Parse(s)).ToArray();
            int[] b = Console.ReadLine().Trim().Split(' ').Select(s => int.Parse(s)).ToArray();
            int[] c = Console.ReadLine().Trim().Split(' ').Select(s => int.Parse(s)).ToArray();
            int point = 0;
            int last_a = 0;
            for (int i = 0; i < n; i++)
            {
                point += b[i];
            }
            for (int i = 0; i < a.Length - 1; i++)
            {
                if (a[i + 1] == (a[i] + 1))
                {
                    point += c[a[i] - 1];
                }
            }
            Console.WriteLine(point);
        }
    }
}


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

		static void solve() {
			Scanner sc = new Scanner(System.in);
			List<String> atcg = new ArrayList<String>();
			atcg.add("A");
			atcg.add("T");
			atcg.add("C");
			atcg.add("G");
			String []s = sc.next().split("");
			int len = 0;
			int max = 0;
			for(int i = 0;i<s.length;i++) {
					if(atcg.contains(s[i])) {
						len++;
						if(len>max) {
							max = len;
						}
					}
					else 
						len = 0;
			}
			System.out.println(max);
			sc.close();
			
		}
	public static void main(String[] args) {
		solve();

	}

}


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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using Graph = vector<vector<int>>;

int main(){
    int N,K; cin>>N>>K;
    vector<ll> p(N); rep(i,N)cin>>p.at(i);
    sort(begin(p),end(p));
    ll res = 0;
    rep(i,K)res+=p.at(i);
    cout<<res<<endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr 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 SORTR(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define MAX 10000
#define nil -1
#define vmax 10000
#define sentinel 2000000000
constexpr long long int inf = 1000000000000;
constexpr long long int rinf = -(INT64_MAX);
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/

int main() {
    int n;
    cin>>n;
    ll ans=0;
    vector<int> a(n,0);
    rep(i,n) {
        cin>>a[i];
    }
    SORT(a);
    if(n%2==0){
        for(int i=0;i<n/2-1;i++){
            ans-=2*a[i];
        }
        ans+=a[n/2]-a[n/2-1];
        for(int i=n/2+1;i<n;i++){
            ans+=2*a[i];
        }
    }else{
        ll temp1=0,temp2=0;
        for(int i=0;i<n/2;i++){
            temp1-=2*a[i];
        }
        temp1+=a[n/2]+a[n/2+1];
        for(int i=n/2+2;i<n;i++){
            temp1+=2*a[i];
        }
        for(int i=0;i<n/2-1;i++){
            temp2-=2*a[i];
        }
        temp2-=a[n/2-1]+a[n/2];
        for(int i=n/2+1;i<n;i++){
            temp2+=2*a[i];
        }
        ans=max(temp1,temp2);
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 640
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int N;
    string s,t;
    cin >> N >> s >> t;
    string ans = "";
    REP(i,N){
        ans += s[i];
        ans += t[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, m, n) for(int i = m; i < (n); i++)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(int i = 0; i < n; i++){ cout << (x[i]) << " ";} cout << endl;
#define printa2(x,m,n) for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ cout << x[i][j] << " ";} cout << endl;}
#define printp(x,n) for(int i = 0; i < n; i++){ cout << "(" << x[i].first << ", " << x[i].second << ") "; } cout << endl;
#define INF (1e18)
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
typedef struct{
    int x;
    int y;
} P;
typedef struct{
    ll to;
    ll cost;
} edge;
typedef pair<ll, ll> lpair;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H ,W, K;
    cin >> H >> W >> K;
    ll num[10][10] = {};
    rep(i,0,(1 << (W-1))){
        if((i & i << 1)) continue;
        int arr[10] = {};
        rep(j,0,W-1){
            if((i >> j) & 1){
                arr[j] = 1;
            }else{
                arr[j] = 0;
            }
        }
        rep(j,0,W-1){
            if(arr[j] == 1){
                num[j][j+1]++;
                num[j+1][j]++;
            }
            if(j != W-2){
                if(arr[j] == 0 && arr[j+1] == 0){
                    num[j+1][j+1]++;
                }
            }else{
                if(arr[j] == 0){
                    num[j+1][j+1]++;
                }
            }
            if(j == 0){
                if(arr[j] == 0){
                    num[0][0]++;
                }
            }
        }
    }
    // printa2(num, W, W);
    ll dp[110][10] = {};
    dp[0][0] = 1;
    rep(i,0,H){
        rep(k,0,W){
            rep(j,0,W){
                dp[i+1][k] += dp[i][j] * num[j][k];
                dp[i+1][k] %= MOD;
            }
        }
    }
    if(W == 1){
        print(1);
    }else{
        print(dp[H][K-1]);
    }
}


Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d",$n,$k);
$result = 0;

$i=1;
while($i<=$n)
{
	if(log($k/$i, 2) < 0)
	{
		$result+=1/$n;
	}
	else
	{
		$result+= (1/$n)*(pow(0.5,ceil(log($k/$i, 2))));
	}
	$i++;
}

echo($result);

Measured memory_bytes: 3576