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

int main(){
    string o, e;
    string pass = "";
    cin >> o >> e;
    int index = 0;
    for(int i = 0; i < o.length() + e.length(); i++){
        if(i % 2 == 0){
            pass = pass + o[index];
        }else{
            pass = pass + e[index];
            index++;
        }
    }
    cout << pass << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define __ <<' '<<
#define ___ <<' '
#define bash push_back
#define ALL(x) x.begin(),x.end()
//#define int long long

struct IoSetup {IoSetup() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout <<fixed<<setprecision(12);
    cerr <<fixed<<setprecision(12);
}}IoSetup;

using ll = long long;
using pii = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int SMOD = 1000000007;
constexpr int NMOD = 998244353;
constexpr int dx[]={1,0,-1,0,1,1,-1,-1};
constexpr int dy[]={0,1,0,-1,-1,1,-1,1};

inline bool inside(int x,int y,int w,int h){return (x>=0 && y>=0 && x<w && y<h);}
template<class T>bool chmax(T &a, const T &b){return(a<b?a=b,true:false);}
template<class T>bool chmin(T &a, const T &b){return(a>b?a=b,true:false);}
inline int qp(int a,ll b,int mo){ll ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}


signed main() {

    ll a, b, n;

    cin >> a >> b >> n;
    
    if(b <= n + 1) {
        cout << a * (b - 1) / b << endl;
        return 0;
    }
    cout << a * n / b << endl;

    
  
    return 0;
}



Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <math.h>

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	cout << N * (N + 1) / 2;
	return 0;
}

Measured memory_bytes: 3600
#include<stdio.h>
int main(){
  int h,m,s;
  for(;;){
    scanf("%d%d%d",&h,&m,&s);
    if(h==-1&&m==-1&&s==-1)
      break;
    s=7200-h*3600-m*60-s;
    printf("0%d:%s%d:%s%d\n",s/3600,s%3600/60<10?"0":"",s%3600/60,s%60<10?"0":"",s%60);
    s*=3;
    printf("0%d:%s%d:%s%d\n",s/3600,s%3600/60<10?"0":"",s%3600/60,s%60<10?"0":"",s%60);
  }
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
string a;
char t;
int aa,b;
bool p;
int main()
{
    t='l';
    cin>>a;
    aa=a.size();
    for(int i=0;i<aa;i++)
    {
        if(a[i]=='C' && b==0)
        {
            b++;
            t='C';
        }
        if(a[i]=='F' && t=='C')
        {
            cout<<"Yes";
            p=1;
            break;
        }
    }
    if(p==0)cout<<"No";                     
    return 0;
} 

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

int main(void)
{
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    double dw = 2 * M_PI * (60 * h + m - 12 * m) / 720;
    double dx = b * sin(dw);
    double dy = b * cos(dw) - a;
    cout << fixed << setprecision(11) << sqrt(dx * dx + dy * dy);    
}


Measured memory_bytes: 4100
n, m = map(int, input().split())

x = list(map(int, input().split()))
if n >= m:
    print(0)
    exit()
x.sort()
dis = [0] * (m - 1)
for i in range(m - 1):
    dis[i] = x[i + 1] - x[i]

dis.sort()
ans = x[m - 1] - x[0]
for i in range(len(dis) - 1, len(dis)- n, -1):
    ans -= dis[i]

print(ans)

Measured memory_bytes: 13968
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <string>
#include <typeinfo>
#include <random>
#include <vector>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<vector<bool>> vvb;
typedef vector<vector<int>> vvi;

#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define all(a) (a).begin(), (a).end()

int canDivide2(int n){
  int count = 0;
  while (n % 2 == 0)
  {
    n /= 2;
    count++;
  }
  return count;
}

int main()
{
  int n;
  cin>>n;
  vi a(n);
  int ans = 0;
  rep(i, n)
  {
    cin >> a.at(i);
    ans += canDivide2(a.at(i));
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;
int dp[51][51][3000];

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int N, A;
    cin >> N >> A;
    vector<int> x(N);
    REP(i, N) cin >> x[i];

    CLR(dp, 0);

    dp[0][0][0] = 1;
    REP(i, N) {
        REP(j, N) {
            REP(k, 3000) {
                dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
                dp[i + 1][j][k] += dp[i][j][k];
            }
        }
    }

    int ans = 0;
    FOR(j, 1, N) {
        ans += dp[N][j][j * A];
    }
    cout << ans << endl;

    return 0;
}


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

int main() {
  long long n,k;
  cin >> n >> k;
  
  bool flag = true;
  long long plus = n;
  long long minus = 0;
  long long ans = n % k;
  
  while (flag){
    if (ans >= 0){
      plus = ans;
      ans = ans - k;
    }
    else{
      flag = false;
      minus = ans;
    }
  }

  if (plus < abs(minus)){
    cout << plus << endl;
  }
  else{
  	cout << abs(minus) << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
//#include<bits/stdc++.h>
using namespace std;
#define Base1   101LL
#define Base2   10000079LL
#define Base3   10000103LL
#define MOD1    1000000007LL
#define MOD2    1000000009LL
#define MOD3    1000000021LL
#define mx 100000//Number of charter of main string
#define mx1 25000// Number off character of total charcater
#define mx2 500// Number of pattern and number of ch of each pattern

int main(){

   ll n,m;
   cin>>n>>m;
   if(n==m)cout<<"Yes"<<endl;
   else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    static <T extends Comparable<? super T>> boolean nextPermutation(T[] sequence) {
        int first = getFirst(sequence);
        if (first == -1) return false;
        int toSwap = sequence.length - 1;
        while (sequence[first].compareTo(sequence[toSwap]) >= 0) --toSwap;
        swap(sequence, first++, toSwap);
        toSwap = sequence.length - 1;
        while (first < toSwap) swap(sequence, first++, toSwap--);
        return true;
    }

    static <T extends Comparable<? super T>> int getFirst(T[] sequence) {
        for (int i = sequence.length - 2; i >= 0; --i)
            if (sequence[i].compareTo(sequence[i + 1]) < 0) return i;
        return -1;
    }

    static <T extends Comparable<? super T>> void swap(T[] sequence, int i, int j) {
        T tmp = sequence[i];
        sequence[i] = sequence[j];
        sequence[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] x = new int[N];
        int[] y = new int[N];
        for (int i = 0; i < N; ++i) {
            x[i] = sc.nextInt();
            y[i] = sc.nextInt();
        }

        Integer[] arr = new Integer[N];
        for (int i = 0; i < N; ++i) arr[i] = i;
        double sum = 0;
        int cnt = 0;
        do {
            for (int i = 0; i < N-1; ++i) {
                sum += Math.sqrt(Math.pow(x[arr[i+1]] - x[arr[i]], 2) +
                        Math.pow(y[arr[i+1]] - y[arr[i]], 2));
            }
            ++cnt;
        } while(nextPermutation(arr));

        System.out.println(sum / cnt);
    }
}

Measured memory_bytes: 23484
#include<iostream> 
#include <algorithm>
#include <vector>
#include <cstdlib>
#include <sstream>
#include <vector>

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

int main() {
	int n, m, x = 0, j=0,i=0;
	
	cin >> n >> m;
	vector <int>a(m), b(m), ans(n, 0);
	rep(i, m) {
		cin >> a.at(i) >> b.at(i);
	}
	rep(i, m) {
		ans.at(a.at(i) - 1) += 1;
		ans.at(b.at(i) - 1) += 1;
	}
	rep(i, n) {
		cout << ans.at(i) << endl;
	}
	return 0;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;

#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio
    
    ll n;cin>>n;
    string s;cin>>s;
    ll a[n+1][2];
    rep(i,0,1)a[0][i]=0;
    rep(i,0,n-1){
        rep(j,0,1)a[i+1][j]=a[i][j];
        if(s[i]=='.')a[i+1][0]++;
        else a[i+1][1]++;
    }
    ll ans=0;
    /*rep(j,0,1){
        rep(i,0,n)cout<<a[i][j]<<" ";cout<<endl;
    }*/
    ll dp[n+1];
    rep(i,0,n){
        if(i-1>=0)dp[i]=a[i][0]+(a[n][1]-a[i][1]);
        else dp[i]=a[i][0]+a[n][1];
        Max(ans,dp[i]);
    }
    cout<<n-ans<<endl;
    
    //rep(i,0,n)cout<<dp[i]<<" ";cout<<endl;
    
    return 0;
}




Measured memory_bytes: 5780
#include <bits/stdc++.h>
 
typedef long long ll;
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
const double PI=3.14159265358979323846;
 
using namespace std;

int main() {

	int n;
	cin >> n;

	int a[n];
	rep(i, n)
		cin >> a[i];

	rep(k, n) {
		if (k > 0) cout << ' ';
		cout << a[k];
	}
	cout << endl;

	int tmp;
	for (int i = 1; i < n; i++) {
		int key = a[i];
		int j = i - 1;
		while (j >= 0 && a[j] > key) {
			a[j+1] = a[j];
			j--;
		}
		a[j+1] = key;
		
		rep(k, n) {
			if (k > 0) cout << ' ';
			cout << a[k];
		}
		cout << endl;
	}
}


Measured memory_bytes: 3100
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
    int a,b;
    cin >>a>>b;
    int ret;
    if(a>b)ret = a+(a-1);
    else if(b>a)ret = b+(b-1);
    else ret = 2*a;
    cout << ret <<endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<cstring>
using namespace std;
const int MAXN=int(2e5+5);
#define INF int(1e9+5)
int n,k;
int a[MAXN];
struct TREE {
    int l,r;
    int Min,Max;
    bool right;
}tree[MAXN*4];
void PushUp(int i) {
    tree[i].Min=min(tree[i*2].Min,tree[i*2+1].Min);
    tree[i].Max=max(tree[i*2].Max,tree[i*2+1].Max);
    tree[i].right=(tree[i*2].right&&tree[i*2+1].right&&tree[i*2].Max<tree[i*2+1].Min);
}
void Build(int i,int l,int r) {
    tree[i].l=l,tree[i].r=r;
    if(l==r) {
        tree[i].right=1;
        tree[i].Max=tree[i].Min=a[l];
        return;
    }
    int mid=(l+r)/2;
    Build(i*2,l,mid);
    Build(i*2+1,mid+1,r);
    PushUp(i);
}
int Query_Min(int i,int l,int r) {
    if(tree[i].l>r||tree[i].r<l)
        return INF;
    if(tree[i].l>=l&&tree[i].r<=r)
        return tree[i].Min;
    return min(Query_Min(i*2,l,r),Query_Min(i*2+1,l,r));
}
int Query_Max(int i,int l,int r) {
    if(tree[i].l>r||tree[i].r<l)
        return -INF;
    if(tree[i].l>=l&&tree[i].r<=r)
        return tree[i].Max;
    return max(Query_Max(i*2,l,r),Query_Max(i*2+1,l,r));
}
bool Query_Right(int i,int l,int r) {
    if(tree[i].l>r||tree[i].r<l)
        return 1;
    if(tree[i].l>=l&&tree[i].r<=r)
        return tree[i].right;
    return (Query_Right(i*2,l,r)&&Query_Right(i*2+1,l,r)&&(Query_Max(i*2,l,r)<Query_Min(i*2+1,l,r)));
}
int main()
{
    int ans=1,cnt=0;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    Build(1,1,n);
    for(int i=1;i<=n-k+1;i++) {
        int l=i,r=i+k-1;
        if(Query_Right(1,l,r))
            cnt++;
    }
    for(int i=k+1;i<=n;i++) {
        int l1=i-k,r1=i-1,id1=i-k;
        int l2=i-k+1,r2=i,id2=i;
        int Min=Query_Min(1,l1,r1);
        int Max=Query_Max(1,l2,r2);
        if((Query_Right(1,l1,r1)&&Query_Right(1,l2,r2))||!(a[id1]==Min&&a[id2]==Max))
            ans++;
    }
    printf("%d",ans-max(0,cnt-1));
}


Measured memory_bytes: 14464
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,w[10000];
  int lsum=0,rsum=0;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>w[i];
    rsum+=w[i];
  }
  int mi=rsum;
  for(int i=n-1;i>=0;i--){
    lsum+=w[i];
    rsum-=w[i];
    mi=min(mi,abs(rsum-lsum));
  }
  cout<<mi<<"\n";
}

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

#define int long long
#define w cout
#define e '\n'
#define sz(x) (int)x.size()
template<class T, class U> inline istream& operator>>(istream& str, pair<T, U> &p) { return str >> p.first >> p.second; }
template<class T> inline istream& operator>>(istream& str, vector<T> &a) { for (auto &i : a) str >> i; return str; }

const int N = 1e6 + 10 , mod = 998244353;

signed main() {
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int a , b; cin >> a  >> b;
	cout << a / b + 1*(a % b != 0);
}	



Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <functional>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(void) {
  ll i, j, k, x, y, z, t, n;
  scanf("%lld%lld%lld%lld", &x, &y, &z, &k);
  ll a[x];
  vector<ll> v1, v2;
  for(i = 0; i < x; ++i) scanf("%lld", &a[i]);
  for(i = 0; i < y; ++i) {
    scanf("%lld", &t);
    for(j = 0; j < x; ++j) v1.push_back(t + a[j]);
  }
  sort(v1.begin(), v1.end(), greater<ll>());
  n = k > x * y ? x * y : k;
  for(i = 0; i < z; ++i) {
    scanf("%lld", &t);
    for(j = 0; j < n; ++j) v2.push_back(t + v1[j]);
  }
  sort(v2.begin(), v2.end(), greater<ll>());
  for(i = 0; i < k; ++i) printf("%lld\n", v2[i]);
  return 0;
}

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

int main(){
	int n,c1,c2,c3,c4;
    cin >> n;
    c1 = 0;
	c2 = 0;
	c3 = 0;
	c4 = 0;
    for (int i = 0; i < n; i++){
        string s;
		cin >> s;
        if (s == "AC") c1 += 1;
        else if (s == "WA") c2 += 1;
        else if (s == "TLE") c3 += 1;
        else if (s == "RE") c4 += 1;
    }
    cout << "AC x " << c1 << endl;
    cout << "WA x " << c2 << endl;
    cout << "TLE x "<< c3 << endl;
    cout << "RE x " << c4 << endl;
}

Measured memory_bytes: 3584
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; ++i)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
using ll = int64_t;
using ld = long double;
using P = pair<int, int>;
using vs = vector<string>;
using vi = vector<int>;
using vvi = vector<vi>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQG = priority_queue<T, vector<T>, greater<T> >;
const int INF = 100010001;
const ll LINF = (ll)INF*INF*10;
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) {return a < b && (a = b, true);}
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) {return a > b && (a = b, true);}
template<typename T1, typename T2>
istream &operator>>(istream &is, pair<T1, T2> &p) { return is >> p.first >> p.second;}
template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) { return os << p.first << ' ' << p.second;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll h, w;
    cin >> h >> w;
    if(h == 1 or w == 1) cout << 1 << endl;
    else cout << (h*w+1)/2 << endl;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,ans=0;
  cin >> n;
  long long a[n+1];
  a[n]=0;
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  for(int i=0;i<n;i++){
    ans+=a[i]/2;
    a[i]%=2;
    if(a[i]&&a[i+1]){
      ans++;
      a[i+1]--;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;cin>>s;
	int num1=0,num2=0;
	for(int i=0;i<s.size();i++){
		if(s[i]=='+') num1++;
		else num2++;
	}
	cout<<num1-num2<<endl;
	
	return 0;
}

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

const int MAX = (1e5)+1;
int n;
long long a[MAX];
vector<int> g[MAX];
void dfs(int u, int p) {
	if(g[u].size() == 1) return;
	long long sum = 0, mx = 0, pr;
	for(int v: g[u]) if(v != p) {
		dfs(v, u);
		sum += a[v];
		mx = max(a[v], mx);
	}
	if(2*mx <= sum) pr = sum/2;
	else pr = sum-mx;
	if(a[u] <= sum && a[u] >= sum-pr) a[u] = 2*a[u]-sum;
	else cout << "NO", exit(0);
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1, u, v; i < n; i++) {
		cin >> u >> v;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	if(n == 2) {
		if(a[1] == a[2]) cout << "YES";
		else cout << "NO";
		return 0;
	}
	int root = 1;
	while(g[root].size() == 1) root++;
	dfs(root, 0);
	if(a[root]) cout << "NO";
	else cout << "YES";
}


Measured memory_bytes: 13184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  string S; cin >> S;
  const ll A = count(range(S), 'R');
  const ll B = count(range(S), 'G');
  const ll C = count(range(S), 'B');
  ll ans = A * B * C;
  for (int i = 0; i < N; i++) {
    for (int j = 1; i - j >= 0 and i + j < N; j++) {
      if (S[i - j] != S[i] and S[i + j] != S[i] and S[i - j] != S[i + j]) {
        ans--;
      }
    }
  }
  cout << ans << endl;
}

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

void solve(){
    std::vector<int>a;
    int x;
    cin>>x;
    a.push_back(x);
    cin>>x;
    a.push_back(x);
    cin>>x;
    a.push_back(x);
    
    sort(a.begin(), a.end()); 
    
    if(a[0]==5 && a[1]==5 && a[2]==7){
        cout<<"YES";
        
    }
    else{
        cout<<"NO";
    }
    
    
    
}

int main() {
    solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long

//----***型定義***----
using ll = long long;
using P = pair<int,int>;

//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn);ii++)
#define RREP(ii,nn,jj) for (ll ii = nn; jj<ii;ii--)
#define each(i,...) for (auto&& i:__VA_ARGS__)
#define ALL(vec) (vec).begin(),(vec).end()
#define sum(...) accumulate(ALL(__VA_ARGS__),0LL)
#define dsum(...) accumulate(ALL(__VA_ARGS__),0.0)
#define vec(type,name,...) vector<type> name(__VA_ARGS__)
template<class T> inline auto max(const T& a){ return *max_element(ALL(a)); }
template<class T> inline auto min(const T& a){ return *min_element(ALL(a)); }
inline ll gcd(ll a,ll b){if(b == 0) return a;return  gcd(b,a%b);}
inline ll lcm(ll a,ll b){ll g = gcd(a,b);return a / g * b;}

//----***定数***----
#define MOD 1000000007
#define INF 100000000000000000
#define EPS 1e-9
const vector<vector<int>> DXY={{-1,0},{1,0},{0,-1},{0,1}};

//----***パーツ***----
#define fi first
#define se second
#define pb push_back
#define re return
#define br break

//----***入出力***---
void print() { std::cout << "\n"; }
template <class T>void print(const T &x) {std::cout << x<<"\n";}
template <class T, class... Args>void print(const T &x, const Args &... args) {std::cout << x << " ";print(args...);}
#define debug(var)  do{std::cerr << #var << " ↓ "<<"\n";view(var);}while(0);
#define dbg cerr<<"🥺🥺🥺🥺🥺🥺"<<endl;
template<typename T> void view(T e){std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

//----***初期時読み込み***----
struct initial{initial(){cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);};}initial_;

signed main(){
  int N,D,X;cin>>N>>D>>X;
  D--;
  vector<int> A(N);
  REP(i,0,N)cin>>A[i];
  REP(i,0,N){
    int d=D;
    while(d>=0){
      X++;
      d-=A[i];
    }
  }
  print(X);


}


Measured memory_bytes: 256
#include<stdio.h>

static const int N = 1000;

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

int main(){
  int n, i, j;
  int A[N+1],v;
  scanf("%d", &n);

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

  for(i = 1; i <= n; i++){
    v = A[i];
    j = i - 1;
    while(j>=0 && A[j] >v){
      A[j+1] = A[j];
      j--;
      A[j+1] = v;
    }
  trace(A, n);
  }

  return 0;
}

Measured memory_bytes: 608
import sys, math
from collections import deque

readline = sys.stdin.readline

S = int(readline())

M = 10 ** 9
rS = math.ceil(math.sqrt(S))

while True:
    rem = rS ** 2 - S

    if rem == 0:
        print('0 0 {} {} {} {}'.format(rS, 0, 0, rS))
        exit(0)

    if rem <= M:
        b = rem
        break
    else:
        b = 0
        a = rem // M + 1
        c = math.floor(rem ** 0.5)
        while a < c and a < M:
            if rem % a == 0:
                b = a
                break
            a += 1
        if b != 0:
            break
    
    if rS >= M:
        rS = M - 1000
    else:
        rS += 1


print('0 0 {} {} {} {}'.format(rS, b, rem // b, rS))

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

typedef vector<int> vi;
typedef pair<int, int> pi;

const ll INF = 1LL << 60;
const ll MOD = 1000003;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, b, e) for (int i = (b); i <= (int)(e); i++)
#define DEBUG(x) cout << #x << ": " << (x) << endl
#define DEBUGA(a) cout << #a << ": "; for (const auto& v: (a)) cout << v << endl

int N, A, B, C, L[10];

int dfs(int i, int a, int b, int c) {
    if (i == N) {
        if (min({a, b, c}) == 0) return 1000000;
        return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    }
    return min({
        dfs(i + 1, a, b, c),
        dfs(i + 1, a + L[i], b, c) + 10,
        dfs(i + 1, a, b + L[i], c) + 10,
        dfs(i + 1, a, b, c + L[i]) + 10
    });
}

signed main() {
    cin >> N >> A >> B >> C;
    REP(i, N) cin >> L[i];
    int ans = dfs(0, 0, 0, 0);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
typedef pair<ll,ll> P;
#define M 1000000007
#define F first
#define S second
#define PB push_back
#define INF 1000000000000000000
ll n,m,e[100005],d[100005],ans;
vector<P>g[100005];
int main(void){
    cin>>n>>m;
    for(int i=1;i<=n;i++){
		ll t;
		scanf("%lld%lld",&t,&e[i]);
		g[0].PB(P(i,t));
	}
	while(m--){
		ll a,b,c;
		scanf("%lld%lld%lld",&a,&b,&c);
		g[b].PB(P(a,c-1));
	}
	for(int i=0;i<=n;i++)d[i]=INF;
	d[0]=0;
	priority_queue<P,vector<P>,greater<P> >dik;
	dik.push(P(0,0));
	while(!dik.empty()){
		ll v=dik.top().S,c=dik.top().F;
		dik.pop();
		if(d[v]<c)continue;
		for(int i=0;i<g[v].size();i++){
			ll u=g[v][i].F,p=g[v][i].S;
			if(d[u]>c+p){
				d[u]=c+p;
				dik.push(P(d[u],u));
			}
		}
	}
	for(int i=1;i<=n;i++)ans+=e[i]*d[i];
	cout<<ans<<endl;
}



Measured memory_bytes: 14400
import java.util.*;
public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int[] num=new int[3];
		int max=0,ind=0;
		for(int i=0;i<3;i++){
			num[i]=sc.nextInt();
			if(num[i]>max){
				max=num[i];
				ind=i;
			}
		}
		if(ind!=2){
			int tmp=num[2];
			num[2]=num[ind];
			num[ind]=tmp;
		}
		if(num[0]>num[1]){
			int tmp=num[0];
			num[0]=num[1];
			num[1]=tmp;
		}
		System.out.println(num[0]+" "+num[1]+" "+num[2]);
	}
}


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

int main() {
    int A, B, K;
    cin >> A >> B >> K;
    vector <int> ans;
    int count = 0;
    rep(i, 101)
    {
        if(A % i == 0 && B % i == 0)
        {
            count++;
            ans.emplace_back(i);
        }
    }
    cout << ans[ans.size() - K] << endl;
    return 0;  
}

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

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

    int ans = 1;

    for (int i = 0; i < n; i++) {
        if (ans > k) {
            ans += k;
        } else {
            ans *= 2;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<int,P> PP;

vector<PP> v;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main()
{
	int a[27] ={0};
	string s;
	cin >> s;
	
	rep(i,26) a[i]=0;
	rep(i,4) a[s[i]-'A']++;
	int cnt = 0;
	rep(i,26){
		if(a[i] == 2) cnt++;
	}
	if(cnt == 2) cout << "Yes" <<endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
N, M = gets.chomp.split.map(&:to_i)
broken = Array.new(M) { gets.chomp.to_i }
stairs = Array.new(N + 2)
broken.each do |i|
  stairs[i] = 0
end
stairs[N] = 1
stairs[N + 1] = 0
(N - 1).downto(0) do |i|
  if stairs[i].nil?
    stairs[i] = stairs[i + 1] + stairs[i + 2]
  end
end
puts stairs[0] % 1000000007


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

int main() {
  string str;
  cin >> str;
  if (str.at(2)==str.at(3)&&str.at(4)==str.at(5)) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 1000000007
#define pb push_back
#define inf 1000000000000000000
void checkpoint1()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	/*#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	*/
}
int main()
{
	checkpoint1();
	ll n,m;
	cin>>n>>m;
	ll w[n+1],v[n+1];
	w[0]=v[0]=0;
	for(ll i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	ll dp[n+1][m+1];
	dp[0][0]=0;
	for(ll i=0;i<=n;i++)
	{
		for(ll j=0;j<=m;j++)
		{
			if(i==0)
				dp[i][j]=0;
			else if(w[i]>j)
				dp[i][j]=dp[i-1][j];
			else
				dp[i][j]=max(dp[i-1][j],v[i]+dp[i-1][j-w[i]]);
		}
	}
	cout<<dp[n][m];
	return 0;
}


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

# define x first
# define y second
# define mp make_pair
// everything goes according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right

# ifdef Local
# define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
# else
# define debug(...) (__VA_ARGS__)
# define cerr if(0)cout
# endif

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") {
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}
ll f (ll b, ll n) {
  ll sum = 0;
  while (n) {
    sum += n%b;
    n /= b;
  }
  return sum;
}

int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  ll n, s;
  cin >> n >> s;

  ll ans = MXLL;

  if (n == s)
    ans = min (ans, s + 1);
  for (int b = 2; b <= sqrt(n); b++) {
    if (f (b, n) == s) {
      ans = b;
      break;
    }
  }

  for (ll k = 1; k <= sqrt(n); k++) {
    if ((s-n) % k == 0) {
      ll b = 1 - ((s-n) / k);
      //cout << k << ' ' << b << endl;
      if (b >= 2 && n / b == k && n%b + k == s && n / b < b) {
        ans = min (ans, b);
      }
    }
  }

  if (ans != MXLL)
    cout << ans;
  else
    cout << -1;



  return 0;
}






// Coded by Z..

Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") 
#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define PI 3.1415926535897932384626 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd; 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++)
#define Dep(i,a,b) for (int i = (b)-1; i >= a; i--)
#define dep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for(auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // Random No.
 
const int MOD = 1000000007;
const char nl = '\n';

void sol() {
    int n; cin >> n;
    int ans;
    if(n%1000==0){
        cout << 0;
    }
    else{
        n = 1000 - n%1000;
        cout << n; 
    }

}               

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

    #ifndef ONLINE_JUDGE
    	freopen("inputA.txt", "r", stdin);
	  #endif    
	
    int T=1;
    while(T--) {            
        sol();                
    }
	
	return 0;
}

Measured memory_bytes: 3644
A,B,K=io.read("n","n","n")
function d(a,b)
    if a%b==0 then
        return b
    end
    local c=a%b 
    return d(b,c)
end
local mod=d(A,B)
local count=0
for i=mod,1,-1 do
    if A%i==0 and B%i==0 then
        count=count+1
    end
    if count==K then
        print(i)
        break
    end
end

Measured memory_bytes: 256
N, M = map(int, input().split())
W = []
for i in range(N):
  W.append(list(map(int, input().split())))
v = [0 for i in range(N)]
m = 0

for a in [1, -1]:
  for b in [1, -1]:
    for c in [1, -1]:
      for i in range(N):
        v[i] = W[i][0]*a + W[i][1]*b + W[i][2]*c
      v = sorted(v, reverse = True)
      m = max(m, sum(v[0:M]))
print(m)

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

using ll=long long;
#define int ll

#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define pb push_back
#define eb emplace_back
#define a first
#define b second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#ifdef LOCAL
#define dmp(x) cerr<<__LINE__<<" "<<#x<<" "<<x<<endl
#else
#define dmp(x) void(0)
#endif

template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(a>b)a=b;}

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class t,class u>
ostream& operator<<(ostream&os, const pair<t,u>&p){
	return os<<"{"<<p.a<<","<<p.b<<"}";
}

template<class t> ostream&operator <<(ostream&os,const vc<t>&v){
	os<<"{";
	for(auto e:v)os<<e<<",";
	return os<<"}";
}

template<class t>
void mkuni(vc<t>&v){
	sort(all(v));
	v.erase(unique(all(v)),v.ed);
}

const int inf=LLONG_MAX/3;


using uint=unsigned;
using ull=unsigned long long;
//const uint mod=998244353;
uint mod=1;
struct mint{
	uint v;
	mint(ll vv=0){s(vv%mod+mod);}
	mint&s(uint vv){
		v=vv<mod?vv:vv-mod;
		return *this;
	}
	mint operator-()const{return mint()-*this;}
	mint&operator+=(const mint&r){return s(v+r.v);}
	mint&operator-=(const mint&r){return s(v+mod-r.v);}
	mint&operator*=(const mint&r){
		v=ull(v)*r.v%mod;
		return *this;
	}
	mint&operator/=(const mint&r){return *this*=r.inv();}
	mint operator+(const mint&r)const {return mint(*this)+=r;}
	mint operator-(const mint&r)const {return mint(*this)-=r;}
	mint operator*(const mint&r)const {return mint(*this)*=r;}
	mint operator/(const mint&r)const {return mint(*this)/=r;}
	mint pow(int n)const{
		mint res=1,x=*this;
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}
	mint inv()const{return pow(mod-2);}
	friend ostream&operator<<(ostream&os,const mint&m){
		return os<<m.v;
	}
};

const int smax=2010;
mint dp[smax][smax][4];

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout<<fixed<<setprecision(20);
	
	int h,w;cin>>h>>w>>mod;
	vc<string> s(h);
	rep(i,h)cin>>s[i];
	rep(i,h)rep(j,w){
		if(i==0&&j==0){
			dp[0][0][0]=1;
			dp[0][0][1]=1;
			dp[0][0][2]=s[0][0]-'0';
		}else{
			mint x[4]{};
			rep(k,4){
				if(i-1>=0)x[k]+=dp[i-1][j][k];
				if(j-1>=0)x[k]+=dp[i][j-1][k];
			}
			dp[i][j][0]=x[0];
			dp[i][j][3]=x[3];
			if(s[i][j]=='+'){
				dp[i][j][1]+=x[0];
				dp[i][j][3]+=x[2];
			}else if(s[i][j]=='*'){
				dp[i][j][1]+=x[2];
			}else{
				dp[i][j][1]+=x[1];
				dp[i][j][2]+=x[1]*(s[i][j]-'0');
				dp[i][j][2]+=x[2]*10;
			}
		}
	}
	cout<<dp[h-1][w-1][2]+dp[h-1][w-1][3]<<endl;
}



Measured memory_bytes: 69992
N = input('')
a =['a', 'b','c','d', 'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
A = ['A', 'B','C','D', 'E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
if N in a:
  print('a')
else:
  print('A')

Measured memory_bytes: 9140
#include <stdio.h>

int main(void){
	int i,j,c;
	int ans;
	int endflag = 0;
	int highests[10];
	while(1){
		for(i = 0; i < 10; i++){
			c = getchar();
			if(c == EOF){
				endflag = 1;
				break;
			}
			highests[i] = c - '0';
		}
		if(endflag){break;}
		getchar();
		for(j = 10; j > 0; j--){
			for(i = 0; i < j; i++){
				if(j == 1){ans = highests[i];}
				else{highests[i] = (highests[i] + highests[i+1] ) % 10;}
			}
		}
		printf("%d\n",ans);
	}


	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

//Circumscribed Circle of a Triangle
public class Main{

	public static class Point {
		public double x;
		public double y;
		public Point(double x_, double y_) {
			x = x_; y=y_;
		}
		public String toString() {return "(" +x+", "+ y +")";}
	}
	
	//ツ陳シツ静シorツ静シツ閉ェツづ個クツδ可ス
	public static class Line {
		public Point s,t;
		public Line(Point s_, Point t_) {
			s = s_; t = t_;
		}
		public String toString() {return s.toString() + " -> " + t.toString();}
	}
	
	public static Point crosspoint(Line l, Line m) {
		if(isParallel(l, m)){
			throw new IllegalArgumentException("parallel");
		}
		  double A = extp(sub(l.t, l.s), sub(m.t, m.s));
		  double B = extp(sub(l.t, l.s), sub(l.t, m.s));
		  if (Math.abs(A) < EPS && Math.abs(B) < EPS) return m.s; // same line
		  if (Math.abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
		  Point tp = sub(m.t, m.s);
		  return new Point(m.s.x + B/A*tp.x, m.s.y + B/A*tp.y);
	}
	
	public static boolean isParallel(Line l, Line m){
		Point a = new Point(l.t.x - l.s.x, l.t.y - l.s.y);
		Point b = new Point(m.t.x - m.s.x, m.t.y - m.s.y);
		if(Math.abs(Math.abs((a.x*b.x + a.y*b.y)/(Math.hypot(a.x, a.y)*Math.hypot(b.x, b.y)) - 1)) < EPS){
			return true;
		}
		return false;
	}
	
	public static Point sub(Point p1, Point p2) {
		return new Point(p1.x-p2.x, p1.y-p2.y);
	}
	
	public static double extp(Point p1, Point p2) {
		return p1.x*p2.y - p2.x*p1.y;
	}
	
	public static final double EPS = 1.0e-8;
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t--!=0){
			Point[] p = new Point[3];
			for(int i=0;i<3;i++)p[i]=new Point(sc.nextDouble(), sc.nextDouble());
			Point mid1 = new Point((p[0].x+p[1].x)/2, (p[0].y+p[1].y)/2);
			Point dv = new Point(p[1].x-p[0].x, p[1].y-p[0].y);
			Point cv = new Point(-dv.y, dv.x);
			Point c1 = new Point(mid1.x+cv.x, mid1.y+cv.y);
			Point mid2 = new Point((p[0].x+p[2].x)/2, (p[0].y+p[2].y)/2);
			dv = new Point(p[2].x-p[0].x, p[2].y-p[0].y);
			cv = new Point(-dv.y, dv.x);
			Point c2 = new Point(mid2.x+cv.x, mid2.y+cv.y);
			Point c = crosspoint(new Line(mid1, c1), new Line(mid2, c2));
			double r = Math.hypot(c.x-p[0].x, c.y-p[0].y);
			System.out.printf("%.3f %.3f %.3f\n", c.x, c.y, r);
		}
	}
}

Measured memory_bytes: 12000
#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <cassert>
//#include <numeric>
#pragma warning(disable:4996) 
 
typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;


class UF
{
private:
    int         num;
    vector<int> par;
    vector<int> siz;
    vector<ll>  wt;   // diff from par
public:
    vector<ll> parval;   // val of root
public:
    UF(int n): num(n) {
        par.resize(n);
        siz.resize(n);
        wt.resize(n);
        parval.resize(n);
        int i;
        for(i=0; i<n; i++) {
            par[i]=i; siz[i]=1;
            wt[i]=0;
            parval[i]=0;
        }
    }
	
    int find(int x) {
        int p=par[x];
        if(x==p) {
            return x;
        }
        int q=find(p);
        ll diff=wt[q]-wt[p];
        wt[x]-=diff;
        return par[x]=q;
    }

    bool unite(int x, int y, ll diff) {     // val[y]=val[x]+diff
        int px=find(x);
        int py=find(y);
        ll diff0=wt[y]-wt[x];
        diff-=diff0;

        x=find(x);
        y=find(y);
        if(x==y) {
            return (wt[y]==wt[x]+diff);
        }
        if(siz[x]<siz[y]) {
            par[x]=y;
            siz[y]=siz[x]+siz[y];
            //val[y]=val[x]+val[y];
            wt[x]=-diff;
        }
        else {
            par[y]=x;
            siz[x]=siz[x]+siz[y];
            //val[x]=val[x]+val[y];
            wt[y]=diff;
        }
        return true;
    }

    bool same(int x, int y) {
        return find(x)==find(y);
    }

    int size(int x) {
        return siz[find(x)];
    }

    ll GetWt(int x) {
        int p=find(x);
        return wt[x];
    }

    int ngroup() {
    //int ngroup( int& ans ) {
        int count=0;
        int i;
        for(i=0; i<num; i++) {
            if(par[i]==i) {
                count++;
                //ans += (val[i]? siz[i]: siz[i]-1);
            }
        }
        return count;
    }

    void print() {
        int i;
        printf("par: "); for(i=0; i<num; i++) printf("%d ", par[i]); printf("\n");
        printf("wt:  "); for(i=0; i<num; i++) printf("%lld ", GetWt(i)); printf("\n");
    }
};

void solve()
{
    int n, m;
    scanf("%d%d", &n, &m);
    UF uf(n);
    int i;
    for (i = 0; i < m; i++) {
        int l, r, d;
        scanf("%d%d%d", &l, &r, &d); l--; r--;
        bool ok = uf.unite(l, r, d);
        if (!ok) {
            printf("No\n"); return;
        }
    }
    printf("Yes\n");

    return;
}

int main(int argc, char* argv[])
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for(t=0; t<T; t++) {
        //printf("Case #%d: ", t+1);
        solve();
    }
#endif
    return 0;
}



Measured memory_bytes: 2560
module.exports=function(t){var e={};function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)r.d(n,i,function(e){return t[e]}.bind(null,i));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=0)}([function(t,e,r){"use strict";var n=r(1);r(2)(n.readFileSync("/dev/stdin","utf8"))},function(t,e){t.exports=require("fs")},function(t,e,r){"use strict";var n=r(3),i=r(5);t.exports=function(t){var e=new n(t);i(e)}},function(t,e,r){"use strict";var n=r(4);t.exports=class{constructor(t){var e=t.trim().split(/\s+/g);this.inp=new n(e)}inr(){return this.inp.deq()}in(){return parseInt(this.inp.deq(),10)}fin(){this.inp.clear()}}},function(t,e,r){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.size=t.length,this.items=t,this.ind=0}enq(t){this.size+=1,this.items.push(t)}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}clear(){this.items=[],this.size=0,this.ind=0}}},function(t,e,r){"use strict";t.exports=function(t){for(var e=t.in(),r=new Array(e),n=0;n<e;n++)r[n]=t.in();if(0==r[0]){for(var i=0,o=0,s=1;s<e;s++){if(o<=r[s]){if(r[s]-o>1)return void console.log(-1);r[s]-o==1&&i++,r[s]-o==0&&(i+=r[s])}else i+=r[s];o=r[s]}console.log(i)}else console.log(-1)}}]);

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
vl modinv;
void fillModInv(ll n, ll mod){
  modinv = vl(n+1);
  modinv[1] = 1;
  FOR(i,2,n+1){
    modinv[i] = modinv[mod%i] * (mod - mod/i) % mod;
  }
}
/*}}}*/
int main() {
  ll n;
  cin >> n;
  set<string> st;
  REP(i,n){
    string name;
    cin >> name;
    st.insert(name);
  }

  
  //cout << fixed << setprecision(10);
  cout << st.size() << endl;
  return 0;
}


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

// Bit Indexed Tree
template <typename T>
struct BIT {
  std::vector<T> dat;

  BIT(int n) : dat(n + 1, 0) {}
  void init(int n) { dat.assign(n + 1, 0); }

  inline void add(int a, T x) {
    for (auto i = a; i < dat.size(); i += i & -i) {
      dat[i] += x;
    }
  }

  // partial sum of [1,to) (1-origin).
  inline T sum(int to) {
    T ret{0};
    for (auto i = to; i > 0; i -= i & -i) {
      ret += dat[i];
    }
    return ret;
  }

  // partial sum of [from,to) (1-origin).
  inline T sum(int from, int to) { return sum(to - 1) - sum(from - 1); }

  // find index at which a_1 + ... + a_i >= w
  int lower_bound(T w) {
    if (w <= 0) {
      return 0;
    } else {
      int x = 0, r = 1;
      while (r < dat.size()) r <<= 1;
      for (auto len = r; len; len >>= 1) {
        if(x+len < dat.size() && dat[x+len] < w) {
          w -= dat[x+len];
          x += len;
        }
      }
      return x + 1;
    }    
  }

  // print all 
  void print() {
    for (auto i = 1; i < dat.size(); ++i) {
      std::cout << (i == 1 ? "" : ", ") << sum(i, i + 1);
    }
    std::cout << std::endl;
  }
};


int main() {
  int N, Q;
  cin >> N >> Q;
  vector<int> c(N);
  for (int &x: c) cin >> x;
  vector<pair<int,int>> q(Q);
  vector<int> ans(Q), ind(Q);
  iota(begin(ind),end(ind),0);
  for (auto &[l,r]: q) cin >> l >> r;
  sort(begin(ind),end(ind),
       [&q](int x, int y) {return q[x].second < q[y].second;});
  vector<int> last(N);
  int lastR{};
  BIT<int> b(N);
  for (int i = 0; i != Q; ++i) {
    int R = q[ind[i]].second;
    if (R > lastR) {
      for (int j = lastR; j < R; ++j) {
        if (last[c[j]]) b.add(last[c[j]],-1);
        last[c[j]] = j+1;
        b.add(last[c[j]],1);
      }
      lastR = R;
    }
    ans[ind[i]] = b.sum(q[ind[i]].first,q[ind[i]].second+1);
  }
  for (int x: ans) cout << x << endl;
}


Measured memory_bytes: 17372
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  if((s.at(5) == '0' && s.at(6) == '1') ||(s.at(5) == '0' &&  s.at(6) == '2' )|| s.at(6) == '3' || s.at(6) == '4'){
    cout << "Heisei" << endl;
  }
  else{
    cout << "TBD" << endl;
  }
  return 0;
}


Measured memory_bytes: 256