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

int main()
{
	for (;;) {
		int x, y, s;
		scanf("%d %d %d", &x, &y, &s);
		if (x == 0 && y == 0 && s == 0)
			break;
		
		int ans = 0;
		for (int i = 1; i < s; ++i) {
			for (int j = 1; j < s; ++j) {
				if (i * (100 + x) / 100 + j * (100 + x) / 100 == s) {
					int t = i * (100 + y) / 100 + j * (100 + y) / 100;
					ans = max(ans, t);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define mem(ar,num) memset(ar,num,sizeof(ar))
#define me(ar) memset(ar,0,sizeof(ar))
#define lowbit(x) (x&(-x))
#define Pb push_back
#define  FI first
#define  SE second
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define IOS ios::sync_with_stdio(false)
#define DEBUG cout<<endl<<"DEBUG"<<endl;
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int    prime = 999983;
const int    INF = 0x7FFFFFFF;
const LL     INFF = 0x7FFFFFFFFFFFFFFF;
const double pi = acos(-1.0);
const double inf = 1e18;
const double eps = 1e-6;
const LL     mod = 1e9 + 7;
LL qpow(LL a, LL b) {LL s = 1; while (b > 0) {if (b & 1)s = s * a % mod; a = a * a % mod; b >>= 1;} return s;}
LL gcd(LL a, LL b) {return b ? gcd(b, a % b) : a;}
int dr[2][4] = {1, -1, 0, 0, 0, 0, -1, 1};
typedef pair<int, int> P;
int main(void)
{
	string s1, s2;
	cin >> s1 >> s2;
	int n = 0;
	for (int i = 0; i < 3; ++i)
		if (s1[i] == s2[i])
			n++;
	cout << n << endl;
	return 0;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
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 nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();
  int M = nextInt();
  cout << (N==M ? "Yes":"No") << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


Measured memory_bytes: 256
N = int(input())
ans = N - 1
p = 1
for i in range(2, int((N ** 0.5) + 1)):
    if p % 2 == 1 and i > (N ** 0.5):
        break
    if N % i == 0:
        p = i
        j = N // i
        m = i + j - 2
        if m < ans:
            ans = m
        else:
            continue
    else:
        continue
print(ans)


Measured memory_bytes: 66508
/*

  "With age, comes wisdom. With travel, comes understanding.
   Remember that happiness is a way of travel – not a destination"

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int            long long int
#define ld             long double
#define F              first
#define S              second
#define pb             push_back
#define si             set <int>
#define vi             vector <int>
#define pii            pair <int, int>
#define vpi            vector <pii>
#define vpp            vector <pair<int, pii>>
#define mii            map <int, int>
#define mpi            map <pii, int>
#define spi            set <pii>
#define endl           "\n"
#define sz(x)          ((int) x.size())
#define all(p)         p.begin(), p.end()
#define que_max        priority_queue <int>
#define que_min        priority_queue <int, vi, greater<int>>
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)       for(auto x : a) cout << x << " "; cout << endl
#define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 200005;
int a[N], n, m, k;

void solve()
{
     int i, j;
     string s, t;
     cin >> n >> s >> t;

     i = 0;
     while (i < n)
     {
          cout << s[i] << t[i];
          i++;
     }


}

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



     cout << setprecision(9) << fixed;
     clock_t z = clock();
     solve();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        int tmt;
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        sc.close();
        if(a>b){
            tmt = a;
            a = b;
            b = tmt;
        }
        if(b>c){
            tmt = b;
            b = c;
            c = tmt;
        }
        if(a>b){
            tmt = a;
            a = b;
            b = tmt;
        }
        System.out.printf("%d %d %d\n",a ,b ,c);
    }
}


Measured memory_bytes: 26268
#include <iostream>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <queue>
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(){
    ll a,b,c; cin>>a>>b>>c;
    if(a<c and c<b){
        cout<<"Yes"<<endl;
    }else if(b<c and c<a){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        x: usize,
    };
    let mut money = 100;

    let mut count = 0;

    while (money < x) == true {
        let gain = money / 100;
        money += gain;
        count += 1;
    }

    print!("{}", count);
}


Measured memory_bytes: 2200
#include <map>
#include <iostream>

#define int long long

using namespace std;

const int N = 2e5 + 10;

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);    
    int x, n;
    cin >> x >> n;
    map<int, int> m;
    for (int i = 0; i < n; ++i) 
    {
        int y;
        cin >> y;
        m[y] = 1;
    }
    int ans = 1e18, num = 0;
    for (int i = -200; i < 200; ++i)
    {
        if (!m[i])
        {
            if (abs(i - x) < ans)
            {
                ans = abs(i - x);
                num = i;
            }
        }
    }
    cout << num;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long int;
using ull = unsigned long long int;
using P = pair<int, int>;
using P3 = pair<double,P>;
using PP = pair<P ,P>;
constexpr ll MOD = ll(1e9+7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e6) + 5;
constexpr double EPS = 1e-8;
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()

int main(){
    char a;
    cin >> a;
    cout << ++a << endl;
    return 0;
}

Measured memory_bytes: 764
package main

import (
	"fmt"
)

var N int
var S []string

func main() {
	fmt.Scanf("%d", &N)

	S = make([]string, N)

	for i := 0; i < N; i++ {
		fmt.Scanf("%s", &S[i])
	}

	m := make(map[string]int)
	for i := 0; i < N; i++ {
		c := []rune(S[i])[0]
		if c == 'M' || c == 'A' || c == 'R' || c == 'C' || c == 'H' {
			if _, ok := m[S[i]]; ok {
				m[S[i]]++
			} else {
				m[S[i]] = 1
			}
		}
	}

	if len(m) < 3 {
		fmt.Println(0)
		return
	}

	values := make(map[rune]int, 5)
	for k, _ := range m {
		c := []rune(k)[0]
		if _, ok := values[c]; ok {
			values[c]++
		} else {
			values[c] = 1
		}
	}

	ans := 0
	march := []rune{'M', 'A', 'R', 'C', 'H'}
	for i := 0; i < len(march); i++ {
		for j := i + 1; j < len(march); j++ {
			for k := j + 1; k < len(march); k++ {
				ans += values[march[i]] * values[march[j]] * values[march[k]]
			}
		}
	}

	fmt.Println(ans)
}

func fact(n int) int {
	if n == 0 {
		return 1
	}
	return n * fact(n-1)
}


Measured memory_bytes: 11648
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>
#include <cstdio>
#include <map>
#include <list>
#include <stdio.h>
#include <sstream>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define _upgrade ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define pb push_back
//ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
//ll lcm(ll x, ll y) {return x / gcd(x, y) * y;}
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const ll mod = 1e9 + 7;
const ll inf = 1LL << 60;
const long double pi = 3.14159265358979323846;
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; }

// ****************************************CODE***************************************//


ll h[110000];
ll dp[110000];

int main() {
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++){
        cin >> h[i];
    }

    for(int i = 0; i < 110000; i++){
        dp[i] = inf;
    }


    dp[0] = 0;

    for(int i = 0; i < n; i++){
        for(int j = 1; j <= k; j++){
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i] - h[i+j]));
        }
    }

    cout << dp[n-1] << endl;
}

Measured memory_bytes: 1920
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int M1,M2,D1,D2;
  cin>>M1>>D1>>M2>>D2;
  cout<<(M1!=M2?1:0)<<endl;
  return 0;
}


Measured memory_bytes: 256
N, S = map(int, input().split())
A = list(map(int, input().split()))
MOD = 998244353

dp = [0] * (S + 1)
ans = 0

for i, a in enumerate(A):
    for s in range(S + 1)[:: -1]:
        if s + a <= S:
            dp[s + a] += dp[s]
    if a <= S:
        dp[a] += (i + 1)
    ans += dp[S]

print(ans % MOD)

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

def modpow(a, n, mod):
  res = 1
  while n > 0:
    if n & 1:
      res = res * a % mod
    a = a * a % mod
    n >>= 1
  return res

mod = 1000000007
ans = modpow(10, n, mod) - (modpow(9, n, mod) + modpow(9, n, mod) - modpow(8, n, mod))
ans = ans % mod
print(ans)

Measured memory_bytes: 9188
#include <bits/stdc++.h>
#define mkp make_pair
#define pb push_back
#define nmax
#define pii pair<int,int>
#define inf
using namespace std;

int main() {
    string s1, s2;
    int n;
    cin>>n;
    cin>>s1>>s2;
    for (int i=0;i<n;++i){
        cout<<s1[i]<<s2[i];
    }
    cout<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
int N;
vector<LL> A;
vector<LL> B;
vector<LL> C;
LL dp[100001];
LL dp2[100001];
LL dp3[100001];
int main(){
    cin>>N;
    REP(i,N){
       LL a;
       cin>>a;
       A.push_back(a);
    }
    REP(i,N){
       LL a;
       cin>>a;
       B.push_back(a);
    }
    REP(i,N){
       LL a;
       cin>>a;
       C.push_back(a);
    }
    sort(A.begin(),A.end());
    sort(B.begin(),B.end());
    sort(C.begin(),C.end());
    REP(i,N){
        dp[i]=1;
    }
    REP(i,N-1){
        dp[i+1]+=dp[i];
    }
    
    int c=0;
    REP(i,N){
        for(int j=c;j<N;j++){
            if(B[i]<=A[j]){
               if(j==0){
                  dp2[i]=0;
               }else{
                  dp2[i]=dp[j-1];
               }
               break;
            }
            c++;
            if(j==N-1){
              // cout<<"aa"<<dp[j]<<endl;
               dp2[i]=dp[j];
            }
        }
        if(c==N){
           dp2[i]=dp[N-1];
        }
    }
    REP(i,N-1){
        dp2[i+1]+=dp2[i];
    }
    
    c=0;
    REP(i,N){
        for(int j=c;j<N;j++){
            if(C[i]<=B[j]){
               if(j==0){
                  dp3[i]=0;
               }else{
                  dp3[i]=dp2[j-1];
               }
               break;
            }
            c++;
            if(j==N-1){
               dp3[i]=dp2[j];
            }
        }
        if(c==N){
            dp3[i]=dp2[N-1];
        }
    }
    REP(i,N-1){
        dp3[i+1]+=dp3[i];
    }
    /*
    REP(i,N){
        cout<<dp[i]<<" "<<dp2[i]<< " "<<dp3[i]<<endl;
    }*/
    cout<<dp3[N-1]<<endl;
    return(0);
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
#define FOR(i, m, n) for (ll i = m; i < (n); i++)
#define RFOR(i, m, n) for (ll i = (m - 1); i >= 0; i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define print(ele) cout << (ele) << "\n"
#define print10(ele) cout << fixed << setprecision(10) << (ele) << "\n"

using namespace std;
typedef long long ll;
typedef vector<int> ivec;
typedef vector<string> svec;
typedef vector<ll> lvec;

const int mod = 1e9 + 7;
const ll INF = 1000000000000000000LL;

int main() {
  int n;
  string s;
  cin >> n >> s;
  int ans = 0;
  FOR(i, 1, n) {
    string x = s.substr(0, i);
    string y = s.substr(i);
    set<char> sx, sy;
    REP(j, x.size()) sx.insert(x[j]);
    REP(j, y.size()) sy.insert(y[j]);
    int count = 0;
    for (char cx : sx) {
      if (sy.count(cx)) {
        count++;
      }
    }
    ans = max(ans, count);
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 256
void main() {
    readln.chomp.count('1').writeln;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>
#include<deque>
#include<queue>
using namespace std;

using ll = long long;
const int INF = 1001001001;
const ll LLINF = 1001001001001001001;
const int MOD = 1000000007;

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

int main()
{
  map<int, int> m;
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) {
    cin >> a[i];
    int value = 0;
    if (m.find(a[i]) != m.end()) {
      value = m.at(a[i]);
      auto itr = m.find(a[i]);
      m.erase(itr);
    }
    m.insert(make_pair(a[i], value+1));
  }

  int result = 0;
  rep(i,n) {
    bool ng = false;
    for (int j = 2; j <= sqrt(a[i]); j++) {
      if (a[i] % j == 0) { // 約数のとき
        if (m.find(j) != m.end()) {
          ng = true;
        }
        if (m.find(a[i] / j) != m.end()) {
          ng = true;
        }
      }
    }
    if (m.at(a[i]) > 1) ng = true; // 自分と同じものが存在するとき
    if (!ng) result++;
  }

  if (m.find(1) != m.end()) {
    result = 1;
    if (m.at(1) > 1) {
      result = 0;
    }
  }
  cout << result << endl;
}



Measured memory_bytes: 13124
import math

n, x = map(int, input().split(" "))
xL = sorted(list(map(int, input().split(" "))) + [x])

diff = [0 for _ in range(n)]
for i in range(n):
    diff[i] = xL[i + 1] - xL[i]

ans = diff[0]
for d in diff:
    ans = math.gcd(ans, d)

print(ans)

Measured memory_bytes: 20420
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class KMP
    {
        int[] lps;

        public void PrintIndex(string text, string pattern)
        {
            StringBuilder sb = new StringBuilder();

            int M = pattern.Length;
            int N = text.Length;
            int i = 0;
            int j = 0;

            ComputeLPS(pattern, M);

            while (i < N)
            {
                if (pattern[j] == text[i])
                {
                    j++;
                    i++;
                }

                if (j == M)
                {
                    sb.AppendLine((i - j).ToString());
                    j = lps[j - 1];
                }

                else if (i < N && pattern[j] != text[i])
                {
                    if (j != 0) j = lps[j - 1];
                    else i++;
                }
            }

            Console.Write(sb);
        }

        private void ComputeLPS(string pattern, int M)
        {
            lps = new int[M];

            int len = 0;
            int i = 1;

            lps[0] = 0;

            while (i < M)
            {
                if (pattern[i] == pattern[len])
                {
                    len++;
                    lps[i] = len;
                    i++;
                }
                else
                {
                    if (len != 0)
                    {
                        len = lps[len - 1];
                    }
                    else
                    {
                        lps[i] = 0;
                        i++;
                    }
                }
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string T = Console.ReadLine();
            string P = Console.ReadLine();

            KMP kmp = new KMP();
            kmp.PrintIndex(T, P);
        }
    }
}

Measured memory_bytes: 46920
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  string S, T;
  cin >> S >> T;

  T.pop_back();

  if(T==S){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

return 0;
}

Measured memory_bytes: 3632
/* in the name of Anton */

/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) ((lli)(x).size())
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;


const auto start_time = std::chrono::high_resolution_clock::now();
void aryanc403()
{
#ifdef ARYANC403
auto end_time = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = end_time-start_time;
    cerr<<"Time Taken : "<<diff.count()<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/aryan/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

lli solve(lli fl)
{
    vi c;
    for(lli i=0;i<n;++i)
    {
        if(i==0||i==n-1)
            c.pb(1);
        else
            c.pb(2);
        if(i%2==fl)
            c.back()*=-1;
    }
    sort(all(c));
    lli ans=0;
    for(lli i=0;i<n;++i)
        ans+=c[i]*a[i];
    return ans;
}

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    a.clear();a.reserve(n);

    fo(i,n)
    {
        cin>>in;
        a.pb(in);
    }
    sort(all(a));
    cout<<max(solve(0),solve(1))<<endl;
}   aryanc403();
    return 0;
}


Measured memory_bytes: 2916
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
int a,b,c,d,e,f;
while (cin>>a>>b>>c>>d>>e>>f) {
 double Dx = c*e-b*f;
 double Dy = a*f-c*d;
 double D  = a*e-b*d;
 double x = Dx/D;
 double y = Dy/D;
 if (x==-0.) x=0;
 if (y==-0.) y=0;
 cout << fixed << setprecision(3) << x << ' ' << y << endl;
 }
return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1 << 30 - 1;
constexpr long long LLINF = 1LL << 60;
constexpr long long MOD = 1000000007;

typedef long long ll;
typedef pair<ll, ll> P;

int sum[4100][4100];
int main()
{
  int N, K;
  cin >> N >> K;
  REP(i, N) {
    int x, y;
    char c;
    cin >> x >> y >> c;
    if (c == 'W') y += K;
    x %= 2*K;
    y %= 2*K;
    sum[y][x]++;
  }
  REP(i, 4*K) REP(j, 4*K) sum[i][j] = sum[i%(2*K)][j%(2*K)];
  REP(i, 4*K) REP(j, 4*K) sum[i + 1][j] += sum[i][j];
  REP(i, 4*K) REP(j, 4*K) sum[i][j + 1] += sum[i][j];

  auto psum = [&](int x1, int y1, int x2, int y2) {
    ll ret = 0;
    ret += sum[x2][y2];
    if (y1 > 0) ret -= sum[x2][y1-1];
    if (x1 > 0) ret -= sum[x1-1][y2];
    if (y1 > 0 && x1 > 0) ret += sum[x1-1][y1-1];
    return ret;
  };

  ll ans = -1;
  REP(i, 2*K) {
    REP(j, 2*K) {
      ll tmp = 0;
      tmp += psum(i, j, i+K-1, j+K-1);
      tmp += psum(i+K, j+K, i+2*K-1, j+2*K-1);
      ans = max(tmp, ans);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 65792
a = input()

a = list(a)
b = a[0]+a[1]
c = a[2]+a[3]

b = int(b)
c = int(c)

if c >= 1 and c <= 12 and b >= 1 and b <= 12:
        print("AMBIGUOUS")

elif c >= 1 and c <= 12:
    print("YYMM")

elif b >= 1 and b <= 12:
    print("MMYY")
    
else:
    print('NA')

Measured memory_bytes: 3064
#include<cstdio>
#include<iostream>
#include<math.h>
using namespace std;

struct Point{
	double x;
	double y;
};

void koch(int n, Point a, Point b)
{
	if(n==0) return;
	Point s,u,t;
	double th = M_PI * 60.0/180.0; 
	

	s.x = (b.x+2*a.x)/3;
	s.y = (b.y+2*a.y)/3;
	
	t.x = (2*b.x+a.x)/3;
	t.y = (2*b.y+a.y)/3;
	
	u.x = (t.x-s.x)*cos(th)-(t.y- s.y)*sin(th) + s.x;
	u.y = (t.x-s.x)*sin(th)+(t.y- s.y)*cos(th) + s.y;
	
	koch(n-1,a,s);
	printf("%.8f %.8f\n",s.x,s.y);
	koch(n-1,s,u);
	printf("%.8f %.8f\n",u.x,u.y);
	koch(n-1,u,t);
	printf("%.8f %.8f\n",t.x,t.y);
	koch(n-1,t,b);
	
}
int main()
{
	Point a;
	a.x= 0;
	a.y= 0;
	Point b;
	b.x = 100;
	b.y = 0;
	
	int n;
	cin >> n;
	
	printf("%.8f %.8f\n",a.x,a.y);
	koch(n,a,b);
	printf("%.8f %.8f\n",b.x,b.y);
	
}

Measured memory_bytes: 3224
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let n=t.n()
  let c=0;
  for(let i=1;i<=n;i++){
    if(String(i).length%2!=0)c++;
  }
  t.o(c)
}
main()

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

using namespace std;

using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    cin >> n;
    vector<ll> a(3), b(3);
    for (int i = 0; i < 3; i++) cin >> a[i];
    for (int i = 0; i < 3; i++) cin >> b[i];

    vector<ll> dp(n + 1, -1);
    dp[0] = 0;
    for (int i = 0; i < 3; i++) {
        if (a[i] >= b[i]) continue;
        for (ll j = 0; j <= n - a[i]; j++) {
            if (dp[j] < 0) continue;
            dp[j + a[i]] = max(dp[j + a[i]], dp[j] + b[i]);
        }
    }

    ll n2 = n;
    for (ll i = 0; i <= n; i++) {
        n2 = max(n2, dp[i] + n - i);
    }

    vector<ll> dp2(n2 + 1, -1);
    dp2[0] = 0;
    for (int i = 0; i < 3; i++) {
        if (a[i] <= b[i]) continue;
        for (ll j = 0; j <= n2 - b[i]; j++) {
            if (dp2[j] < 0) continue;
            dp2[j + b[i]] = max(dp2[j + b[i]], dp2[j] + a[i]);
        }
    }

    ll ans = n2;
    for (ll i = 0; i <= n2; i++) {
        ans = max(ans, dp2[i] + n2 - i);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 195584
import java.io.IOException;
import java.util.Scanner;
class Main{
	public static void main(String[] args)throws NumberFormatException, IOException{
		Scanner scan = new Scanner(System.in);
		
		String ringText =scan.nextLine();
		int ringLength = ringText.length();
		char[] ringChar = ringText.toCharArray();
		
		String target =scan.nextLine();
		int targetLength = target.length();
		
		String hikaku = "";
		
		boolean kai = false;
		
		for(int i=0; i<ringLength; i++){
				hikaku = "";
//				kai = false;
				
				for(int j=0; j<targetLength; j++){
					int i2 = j;
					if(i + i2 >= ringLength){
						i2 -= ringLength;
					}
					hikaku = hikaku + ringChar[i+i2];
				}
				if(target.equals(hikaku)){
					System.out.println("Yes");
					kai = true;
					break;
				}
		}
		
		if(kai == false){
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 26768
import java.util.Scanner;
 
class Main{
  public static void main(String[] arg){
    int H, W;

    Scanner in = new Scanner(System.in);

    while(true){
        H = in.nextInt();
        W = in.nextInt();

        if(H == 0 && W == 0) return;
        
        for(int i=0; i<H; i++){
            for(int j=0; j<W; j++){
                if(i == 0 || i == H-1)
                    System.out.print("#");
                else {
                    if(j == 0 || j == W-1)
                        System.out.print("#");
                    else
                        System.out.print(".");
                }
            }
            System.out.println();
        }
        System.out.println();
    }
    
  }
}

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

int main() {
    long long n;
    cin >>n;
    vector<long long>a(n);
    for(long long i=0; i<n; ++i){
        cin >> a[i];
    }
    long long d=0;
    long long ans=0;
    for(long long i=0; i<n; ++i){
        if(a[i]-d==1){
            d=a[i];
            ans +=1;
        }
    }
    if(d==0){
        cout << -1 << endl;
        return 0;
    }
    cout << n-ans << endl;
}

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

int main(){
    int s;
    cin >> s;
    int l = s / 100;
    int r = s % 100;

    if(1 <= l && l <= 12){
        if(1 <= r && r <= 12) cout << "AMBIGUOUS" << endl;
        else cout << "MMYY" << endl;
    }
    else {
        if(1 <= r && r <= 12) cout << "YYMM" << endl;
        else cout << "NA" << endl;
    } 
   return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    ll a,b,c;
    cin>>a>>b>>c;
    if(a>b)
        swap(a,b);
    if(c>=a && c<=b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};
const int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
const string dir8[8] = {"U", "RU", "R", "RD", "D", "LD", "L", "LU"};

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
// clang-format on

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X, Y, Z;
  cin >> X >> Y >> Z;

  printf("%d %d %d\n", Z, X, Y);

  return 0;
}


Measured memory_bytes: 888
#pragma GCC optimize("Ofast")
#pragma GCC target ("avx")
#include <bits/stdc++.h>

constexpr int INF = 2147483647;
constexpr long long int INF_LL = 9223372036854775807;
constexpr int MOD = 1000000007;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	string S;
	cin >> S; //RLでループ
	vector<int> moyori(S.size());
	int tmp = S.size() - 1;
	for (int i = S.size()-1; i >= 0; i--) { //Rについて
		if (S[i] == 'L')tmp = i;
		else {
			moyori[i] = tmp;
		}
	}
	tmp = 0;
	for (int i = 0; i < S.size(); i++) { //Lについて
		if (S[i] == 'R')tmp = i;
		else {
			moyori[i] = tmp;
		}
	}
	vector<int> dist(S.size()), ans(S.size(), 0);
	for (int i = 0; i < S.size(); i++)dist[i] = abs(moyori[i] - i) % 2;
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == 'R') {
			if (dist[i] == 0) {
				ans[moyori[i]]++;
			}
			else {
				ans[moyori[i] - 1]++;
			}
		}
		if (S[i] == 'L') {
			if (dist[i] == 0) {
				ans[moyori[i]]++;
			}
			else {
				ans[moyori[i] + 1]++;
			}
		}
	}
	for (int i = 0; i < S.size(); i++)cout << ans[i] << " ";
	cout << endl;
}

Measured memory_bytes: 1920
// Problem : B - ROT N
// Contest : AtCoder Beginner Contest 146
// URL : https://atcoder.jp/contests/abc146/tasks/abc146_b
// Memory Limit : 1024.000000MB 
// Time Limit : 2000.000000milisec 
// Powered by CP Editor (https://github.com/coder3101/cp-editor2)

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
//#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#define pb push_back
#define IOS                                                                    \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);cout<<fixed<<setprecision(16);
#define ll long long int
#define ld long double
#define el '\n'
#define El '\n'
#define PI (ld)3.141592653589793238462643383279502884197169399375105820974944
#define inf (ll)1000000000
#define mod (ll)1000000007
#define mod1 (ll)998244353
#define fo(i, n) for (long long i = 0; i < n; i++)
#define pll pair<ll, ll>
#define ml map<ll,ll>
#define vpl vector<pll>
#define vvl vector<vector<ll> >
#define vvpl vector< vector<pll> >
#define ff first
#define ss second
#define pqueue priority_queue< ll >
#define pdqueue priority_queue< ll,vl ,greater< ll > >
#define mem(a,b) memset(a,b,sizeof(a));
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define sz(a) (ll)a.size()
#define all(a) a.begin(),a.end()
#define vl vector<ll>


/*#define error(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 << endl;
	err(++it, args...);
}*/


//#define x ff
//#define y ss
#define pt(a) for(auto it:a)cout<<it<<" ";cout<<endl;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
using namespace std;

using namespace __gnu_pbds;
 
typedef tree<pll,null_type,less<pll>,rb_tree_tag,tree_order_statistics_node_update> order_set;

// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << t<<" "; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << v.first << " " << v.second ; }

double gcd(double a, double b) { return a < 0.01 ? b : gcd(fmod(b, a), a); }

long long bpow(long long a, long long b, long long m) {
  a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1)res = res * a % m;
      a = a * a % m;
      b >>= 1;
  }
  return res;
}


ll kv;
ll t,n,x,y,h,k,z,p,q,w;
string s,s1,s2;
//vvl v;
//vl vis,d;

int main() {
    IOS;
    cin>>k;
	cin>>s;
	n=sz(s);
	fo(i,n)s[i]=(s[i]-'A'+k)%26+'A';
	cout<<s;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
static const int MAX = 10000;
static const int INFTY = (1 << 20);
int V;
std::vector<std::pair<int, int> > G[MAX];

void dijkstra() {
    std::priority_queue<std::pair<int, int> > pq;
    bool visited[MAX];
    int d[MAX];
    for (int i = 0; i < V; i++) {
        visited[i] = false;
        d[i] = INFTY;
    }
    d[0] = 0;
    pq.push({0, 0}); //dist from target * -1, current node
    visited[0] = true;

    while ( !pq.empty() ) {
        std::pair<int, int> f = pq.top(); pq.pop();
        int current = f.second;
        visited[current] = true;

        if (d[current] < f.first * (-1)) continue;

        for (unsigned long i = 0; i < G[current].size(); i++) {
            int target = G[current][i].first;
            if (visited[target]) continue;
            if (d[target] > d[current] + G[current][i].second) {
                d[target] = d[current] + G[current][i].second;
                pq.push({d[target] * (-1), target});
            }
        }
    }

    for (int i = 0; i < V; i++) {
        std::cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << std::endl;
    }
}



int main()
{
    int source, target, cost, edges;
    std::scanf("%d", &V);
    for (int i = 0; i < V; i++) {
        std::scanf("%d %d", &source, &edges);
        for (int j = 0; j < edges; j++) {
            std::scanf("%d %d", &target, &cost);
            G[source].push_back({target, cost});
        }
    }
    dijkstra();
    return 0;
}



Measured memory_bytes: 8156
INF = float('inf')
N, M = map(int, input().split())
C = [int(c) for c in input().split()]
T = [[INF] * (N + 1) for _ in range(M + 1)]
for i in range(M + 1):
    T[i][0] = 0

for i in range(1, M + 1):
        for j in range(1, N + 1):
            if N + 1 < j - C[i - 1] or j - C[i - 1] < 0:
                T[i][j] = T[i - 1][j]
            else:
                T[i][j] = min(T[i - 1][j], T[i][j - C[i - 1]] + 1)

ans = []
for i in range(1, M + 1):
    ans.append(T[i][N])

print(min(ans))



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

void findit(int n,long double p[])
{
    long double dp[n+1][n+1];
    
    for(int i=0;i<=n;i++)
    {
        dp[0][i]=(long double)(0);
    }
    
    dp[0][0]=(long double)(1);
    
    for(int i=1;i<=n;i++)
    {
      dp[i][0]=dp[i-1][0]*(1-p[i-1]); 
    }
    
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            if(j>i)
            {
                dp[i][j]=(long double)(0);
            }
            
            else
            {
                dp[i][j]=p[i-1]*dp[i-1][j-1]+(1-p[i-1])*dp[i-1][j];
            }
        }
    }
    
   
    
    long double ans=(long double)(0.00000000000);
   //cout<<ans<<" ";
    
    for(int i=n;i>=n/2+1;i--)
    {
      //  cout<<dp[n][i]<<" ";
        ans=ans+dp[n][i];
    }
 //   cout<<"\n";
    cout<<setprecision(10)<<ans;
    
}


int main()

{
    int n;
    cin>>n;
    
    long double p[n];
    
    for(int i=0;i<n;i++)
    {
        cin>>p[i];
    }
    
    findit(n,p);
    
	
	return 0;
}


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

using namespace std;
using ll = long long;

ll Sum(ll n) { return (n * (n + 1) / 2) % 1000000007; }

struct ModComb {
	vector<long long> fac;
	vector<long long> ifac;
	const long long MOD = 1000000007;

	template <typename T>
	T power(T a, T b) {
		T ret = 1;
		while (b > 0) {
			if (b&1) { (ret *= a) %= MOD; }
			(a *= a) %= MOD;
			b >>= 1;
		}
		return ret;
	}

	ModComb(const size_t SIZE) {
		fac.assign(SIZE, 0);
		ifac.assign(SIZE, 0);

		fac[0] = ifac[0] = 1;
		for (int i = 1; i < SIZE; ++i) {
			fac[i] = (fac[i - 1] * i) % MOD;
			ifac[i] = power(fac[i], MOD - 2) % MOD;
		}
	}

	long long nCr(size_t n, size_t r) {
		return (((fac[n] * ifac[r]) % MOD) * ifac[n - r]) % MOD;
	}
};

int main() {
	const ll MOD = 1e9 + 7;
	ll N, M, K;
	cin >> N >> M >> K;

	ModComb comb(N * M + 1);
	ll C, res = 0;
	if (N * M == 2 || K == 2) { C = 1; }
	else { C = comb.nCr(N * M - 2, K - 2); }
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < M; ++j) {
			ll cost = (Sum(N - i - 1) * M + Sum(j) * (N - i - 1) + Sum(M - j - 1) * (N - i)) % MOD;
			(res += (cost * C) % MOD) %= MOD;
		}
	}

	cout << res % MOD << endl;

	return 0;
}


Measured memory_bytes: 3328
using System;
public class c
{
  public static void Main()
  {
    int n=int.Parse(Console.ReadLine());
    int k=int.Parse(Console.ReadLine());
    int x=int.Parse(Console.ReadLine());
    int y=int.Parse(Console.ReadLine());
    if(n<=k)Console.WriteLine(n*x);
    else Console.WriteLine(k*x+(n-k)*y);
  }
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

typedef long long lint;
const double EPS = 1e-9;

typedef struct Point {
	double x, y, z;
	Point (double x_, double y_, double z_) : x(x_), y(y_), z(z_) {}
	Point operator + (const Point& a) const { return Point(x + a.x, y + a.y, z + a.z); }
	Point operator - (const Point& a) const { return Point(x - a.x, y - a.y, z - a.z); }
	Point operator * (double d) const { return Point(x * d, y * d, z * d); }
} Vector;

struct Object {
	Point p; double r; lint l;
	Object(Point p_, double r_, lint l_) : p(p_), r(r_), l(l_) {}
};

double sqr(double x) { return x * x; }
double distance(const Point& a, const Point& b) { return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y) + sqr(a.z - b.z)); }

bool collision(const Object& obj, const Point& a, const Point& b) {
	Vector unit = b - a;
	
	double lb = 0.0, ub = 1.0;
	
	for_(i,0,50) {
		double lft = (lb * 2. + ub) / 3., rgt = (lb + ub * 2.) / 3.;
		Point pl = a + unit * lft, pr = a + unit * rgt;
		double dl = distance(obj.p, pl), dr = distance(obj.p, pr);
		if (dl < dr) ub = rgt;
		else lb = lft;
	}
	
	return distance(obj.p, a + unit * lb) < obj.r + EPS;
}

int main() {
	int N, Q;
	cin >> N >> Q;
	
	vector< Object > obj;
	
	for_(i,0,N) {
		double x, y, z, r; lint l;
		cin >> x >> y >> z >> r >> l;
		obj.push_back(Object(Point(x, y, z), r, l));
	}
	
	for_(i,0,Q) {
		double x1, y1, z1, x2, y2, z2;
		cin >> x1 >> y1 >> z1 >> x2 >> y2 >> z2;
		Point red(x1, y1, z1), blue(x2, y2, z2);
	
		lint ans = 0;
		for_(j,0,N) if (collision(obj[j], red, blue)) ans += obj[j].l;
		cout << ans << endl;
	}
}

Measured memory_bytes: 1244
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct Node{
  int key;
struct  Node *right,*left,*parent;
};
struct Node *root,*NIL;
void insert(int k)
{
struct  Node *y=NIL;
struct  Node *x=root;
 struct  Node *z;
  z=(struct Node*)malloc(sizeof(struct Node));
  z->key=k;
  z->left=NIL;
  z->right=NIL;
  while(x!=NIL){
    y=x;
    if(z->key<x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL)
    {
      root=z;
    }
  else{
    if(z->key<y->key){
      y->left=z;
    }
    else{
      y->right=z;
    }
  }
}
void inorder(struct Node *u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
  
  
}
void preorder(struct Node *u){
  if(u==NIL) return ;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
int main()
{
  int n,i,x;
  char com[20];
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%s",com);
      if(strcmp(com,"insert")==0){
	scanf("%d",&x);
	insert(x);
      }
      else if(strcmp(com,"print")==0){
	inorder(root);
	printf("\n");
	preorder(root);
	printf("\n");
      }
    }
  return 0;
}

Measured memory_bytes: 24040
#include<stdio.h>                                                    
int main(void)
{
   int n,i,res=0;
   int c[50],v[50],r[50];
 
   scanf("%d",&n);
 
   for(i=0;i<n;i++){
      scanf("%d",&v[i]);
   }
   for(i=0;i<n;i++){
      scanf("%d",&c[i]);
   }
 
   for(i=0;i<n;i++){
      r[i]=v[i]-c[i];
      if(r[i]>0){
            res +=r[i];
         }
   }
 
   printf("%d",res);
   return 0;
}

Measured memory_bytes: 128
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//コンパイラオプション？お試し中
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

const int dm = 1 << 19;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[4];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint(), M = getint(), L = getint();
	int C[300][300];
	rep(j, N) rep(i, j) C[i][j] = 1e9 + 1;
	rep(i, M) {
		int a = getint(), b = getint(), c = getint();
		C[--a][--b] = c;
		C[b][a] = c;
	}

	rep(k, N) {
		rep(j, k) {
			rep(i, j) {
				chmin(C[i][j], C[i][k] + C[j][k]);
			}
		}
		for (int j = k + 1; j < N; j++) {
			rep(i, k) {
				chmin(C[i][j], C[i][k] + C[k][j]);
			}
			for (int i = k + 1; i < j; i++) {
				chmin(C[i][j], C[k][i] + C[k][j]);
			}
		}
	}

	rep(j, N) rep(i, j) {
		C[i][j] = (C[i][j] <= L) ? 1 : 1e9;
	}

	rep(k, N) {
		rep(j, k) {
			rep(i, j) {
				chmin(C[i][j], C[i][k] + C[j][k]);
			}
		}
		for (int j = k + 1; j < N; j++) {
			rep(i, k) {
				chmin(C[i][j], C[i][k] + C[k][j]);
			}
			for (int i = k + 1; i < j; i++) {
				chmin(C[i][j], C[k][i] + C[k][j]);
			}
		}
	}

	int Q = getint();
	rep(i, Q) {
		int s = getint(), t = getint();
		if (--s > --t) swap(s, t);
		if (C[s][t] == 1) {
			*di++ = '0';
			*di++ = '\n';
		}
		else if (C[s][t] < 1e9) putint(C[s][t] - 1);
		else {
			*di++ = '-';
			*di++ = '1';
			*di++ = '\n';
		}
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 1152
#include <iostream>

using namespace std;

int
main()
{
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    int t1 = a;
    int t2 = c;
    while(1){
        t2 = t2 - b;
        if(t2 <= 0) {
            cout << "Yes" << endl;
            break;
        }

        t1 = t1 - d;
        if(t1 <= 0) {
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}


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

using namespace std;

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

    cin >> a >> b >> c;

    if (a < c && c < b) cout << "Yes" << endl;
    else if (b < c && c < a) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
using namespace std;
using ll=long long;
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <map>
#define out(S) cout<<(S)<<endl;
#define mod(i) ((i)%(ll)(1000000000 + 7))
ll modpow(ll i, ll j) { ll tmp = 1; while (j) { if (j % 2)tmp = mod(tmp*i); i = mod(i*i); j /= 2; }return tmp; }
#define divmod(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define For(i,a,b) for(size_t i=(a);i<(b);i++)
#define rFor(i,a,b) for(size_t i=(a)-1;i>=(b);i--)
#define Rep(i,a) for(size_t i=0;i<(a);i++)
#define rRep(i,a) for(size_t i=(a)-1;i>=0;i--)
#define Foreach(item,collection) for(auto item:collection)

int main(){
	string s;
	cin >> s;
	Foreach(item, s) {
		if (item == ',') { cout<<" "; }
		else { cout<<item; }
	}
	cout << endl;
	return 0;
}



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

int main(){
    int n,d;cin>>n>>d;
    double dist2=0;
    int ans=0;
    vector<vector<int> > x(d,vector<int>(n));
    for(int i=0;i<n;i++){
      for(int j=0;j<d;j++){
        cin>>x.at(j).at(i);
      }
    }
    for(int i=0;i<n;i++){//あとでn子引く
      for(int j=0;j<n;j++){
          dist2=0;
        for(int k=0;k<d;k++){
          dist2+=(x.at(k).at(i)-x.at(k).at(j))*(x.at(k).at(i)-x.at(k).at(j));
        }
        if(float(sqrt(dist2))==int(sqrt(dist2))){
          ++ans;
          //cout<<dist2<<endl;
        }
      }
    }
    ans=ans-n;
    ans=ans/2;
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(void){
	double x1,y1,x2,y2;
	scanf("%lf %lf %lf %lf",&x1,&y1,&x2,&y2);
	printf("%f\n",sqrt((pow((x1-x2),2)+(pow((y1-y2),2)))));
	return 0;
}


Measured memory_bytes: 2044