akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

template <class T> ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = v.begin(); i != v.end(); i++) {
    os << *i << " ";
  }
  return os;
}


void solve(long long X){
  ll q = X/100;
  if(q*100<=X and X<=q*105)
    std::cout << 1 << std::endl;
  else
    std::cout << 0 << std::endl;
}

int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll N; cin >> N;
  vector<ll> A(N);
  rep(i, N) { cin >> A[i]; }
  ll ans = 0;
  for(ll i=1; i<N; ++i) {
    if(A[i] < A[i-1]) {
      ll tmp = A[i-1]-A[i];
      ans += tmp;
      A[i] += tmp;
    }
  }
  cout << ans << endl;
}


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

typedef pair<double, int> P;

int main()
{
    int n;
    double t;
    vector<P> v;
    vector<P>::iterator it;
    for(int i = 0; i < 3; i++) {
        vector<P> vt;
        for(int j = 0; j < 8; j++) {
            cin >> n >> t;
            vt.push_back(P(t, n));
        }

        sort(vt.begin(), vt.end());

        it = vt.begin();
        for(int j = 0; j < 2; j++) {
            cout << (*it).second << " " << (*it).first << endl;
            it = vt.erase(it);
        }

        for(it = vt.begin(); it != vt.end(); it++)
            v.push_back((*it));
    }

    sort(v.begin(), v.end());
    it = v.begin();
    for(int i = 0; i < 2; i++) {
        cout << (*it).second << " " << (*it).first << endl;
        it++;
    }

}

Measured memory_bytes: 0
from sys import *
from collections import *

def uck(e,y):
  d = Counter(dict(e))
  for i in xrange(1,13):
    if d[i] < 0 or d[i] >= 5: return False
  ab = 0
  for i in xrange(1,10): ab += abs(d[i])
  if ab == 0: return True

  for i in xrange(1,10):
    if d[i] == 0 : continue
    d[i]-=3
    if uck(d,y): return True
    d[i]+=3
    if not y:
      d[i]-=2
      if uck(d,True): return True
      d[i]+=2
    d[i]-=1;d[i+1]-=1;d[i+2]-=1
    if uck(d,y):return True

for s in stdin:
  s = map(int,s[:-1]); v = ""
  for j in xrange(1,10):
    if len(s) == 14: s=s[:-1]
    s.append(j)
    if uck(Counter(sorted(s)),False): v += str(j)+" "
  if v == "": print 0
  else: print v[:-1]

Measured memory_bytes: 4644
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <map>
#include <cstdlib>
#include <math.h>

using namespace std;

typedef long long ll;
#define rep(i, n) for(long (i) = 0; (i) < (long) (n); (i)++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,a,b) for(long i=(a);i<(b);i++)
#define rrep1(i,a,b) for(long i=(a);i<=(b);i++)
#define rrrep(i,a,b) for(long i=(a);i>=(b);i--)
#define define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()
#define X first
#define Y second
#define vi vector<int>
#define vl vector<ll>
#define vvi vector<vector<int> >
#define vpl vector<pair<long, long> >
#define vppl vector<pair<long, pair<long, long> > >

const int INF = 100100100;
const long LONG_INF = 2147483647;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
const ll LINF = 1e18;


int pow(int x) {
	if (x == 0) {
		return 1;
	}
	else {
		return pow(x - 1) * 2;
	}
}

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    string a;
    cin >> a;
    int count = 0;
    int maxCount = 0;
    rep(i, a.length()){
        string b = a.substr(i,1);
        if (b == "A" || b == "C" || b == "G" || b == "T") {
            count++;
            if (maxCount < count) {
                maxCount = count;
            }
        } else
        {
            if (maxCount < count) {
                maxCount = count;
            }
            count = 0;
        }
    }
    cout << maxCount << endl;
    return 0;
}


Measured memory_bytes: 256
/*
ID: wangjun30
LANG: C++14
TASK:
*/
#include<iostream>
//#include<fstream>
using namespace std;
//ifstream cin(".in");
//ofstream cout(".out");
int main(){
	int n;
	cin>>n;
	double ans=0;
	for(int i=1;i<=n;i++){
		string s;
		double mon;
		cin>>mon>>s;
		if(s=="JPY")
			ans+=mon;
		else
			ans+=mon*380000.00;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,M=MI()
    edge_matrix = [[False]*N for _ in range(N)]
    for _ in range(M):
        a,b = MI_()
        edge_matrix[a][b] = True
        edge_matrix[b][a] = True
    ans = 0
    for it in permutations([i for i in range(N)]):
        path = [i for i in it]
        if path[0]!=0:
            continue
        ok = True
        for i in range(N-1):
            from_ = path[i]
            to_ = path[i+1]
            if not edge_matrix[from_][to_]:
                ok = False
                break
        if ok:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 67176
#include<bits/stdc++.h> 
#define ll long long 
#define pb push_back 
#define vec vector<int> 
#define fo(i,n) for (ll i = 0; i < n; i++)
#define so(v) sort(v.begin(), v.end())
#define fi first
#define se second 
using namespace std;  
int main()
{
 ll n;
 cin>>n;
 int ac=0;
 int wa=0;int tle=0;int re=0;
 for(int i=0;i<n;i++)
 {
     string s;
     cin>>s;
     if(s=="AC")
     ac++;
     if(s=="WA")
     wa++;
     if(s=="TLE")
     tle++;
     if(s=="RE")
    
     re++;
 }
 cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tle<<endl<<"RE x "<<re;
 
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template <class T> bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template <class T> bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int k;
    cin>>k;
    int n=50;
    vector<int> a(n);
    REP(i,n) {
        a[i]=i;
        a[i]+=(k/n);
    }
    k%=n;
    REP(i,k) {
        a[i]+=n;
        REP(j,n) {
            if(i==j) continue;
            a[j]--;
        }
    }
    cout<<n<<endl;
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = Integer.parseInt(sc.next());
        int B = Integer.parseInt(sc.next());
        sc.close();

        if (A>9 || B>9) {
            System.out.println("-1");
        } else {
            System.out.println(A*B);
        }
    }
}

Measured memory_bytes: 23380
fn main() {
    proconio::input! {
        n: usize,
        xyp: [(i32,i32,u64);n],
    }
    let mut xd=vec![vec![0;n];1<<n];
    let mut yd=vec![vec![0;n];1<<n];
    for (b,(xd,yd)) in xd.iter_mut().zip(yd.iter_mut()).enumerate() {
        for (&(x,y,_),(xd,yd)) in xyp.iter().zip(xd.iter_mut().zip(yd.iter_mut())) {
            let mut d=(x.abs(),y.abs());
            let mut b=b;
            while b>0 {
                let (x2,y2,_)=xyp[b.trailing_zeros()as usize];
                d.0=(x-x2).abs().min(d.0);
                d.1=(y-y2).abs().min(d.1);
                b&=b-1;
            }
            *xd=d.0;
            *yd=d.1;
        }
    }
    let mut m=vec![std::u64::MAX;n+1];
    for b in 0..3u32.pow(n as u32) {
        let mut b=b;
        let mut bx=0;
        let mut by=0;
        let mut i=0;
        while b>0 {
            let k=b%3;
            b/=3;
            if k==1 {
                bx|=1<<i;
            }
            else if k==2 {
                by|=1<<i;
            }
            i+=1;
        }
        let mut s=0;
        for (p,(&xd,&yd)) in xyp.iter().map(|xyp|xyp.2).zip(xd[bx].iter().zip(yd[by].iter())) {
            s+=p*xd.min(yd)as u64;
        }
        let k=(bx|by).count_ones()as usize;
        m[k]=m[k].min(s);
    }
    for m in m {
        println!("{}",m);
    }
}

Measured memory_bytes: 8608
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;
class Main{

    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        long[] a = new long[(1<<N)];
        for(int i=0;i<(1<<N);++i)a[i]=scan.nextLong();
        PrintWriter out = new PrintWriter(System.out);
        long bef=0;
        for(int K=1;K<(1<<N);++K){
            long max1=-1;
            long max2=-1;
            for(int j=K;j>=0;--j){
                j&=K;
                if(a[j]>max1){
                    max2=max1;
                    max1=a[j];
                }else if(a[j]>max2){
                    max2=a[j];
                }
            }
            bef=Math.max(bef, max1+max2);
            out.println(bef);
        }
        out.flush();out.close();
    }
}

Measured memory_bytes: 96732
#include <bits/stdc++.h>
#define ll long long
#define LL long long
#define db double
#define iosks std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define PI acos(-1)
const ll mod=1e9+7;
int main()
{
    int t;
    cin >> t;
    if(t>=30)
        cout << "Yes";
    else
        cout << "No";
    return 0;
}


Measured memory_bytes: 3620
from fractions import gcd
n,x = map(int,input().split())
ls = list(map(int,input().split()))
new = [0]*n
for i in range(n):
    new[i] = abs(ls[i]-x)
ans = new[0]
for j in range(1,n):
    ans = gcd(ans,new[j])
print(ans)

Measured memory_bytes: 16284
#include <bits/stdc++.h>
using namespace std;
//debug
#ifdef grief
#define debug(...) do{\
	fprintf(stderr , "%s - %d : (%s) = " , __PRETTY_FUNCTION__ , __LINE__ , #__VA_ARGS__ );\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){
	cerr<<x<<endl;
}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){
	cerr<<x<<" , ";
	_DO(tail...);
}
#else
#define debug(...)
#endif
//type
typedef long long ll;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef priority_queue<pll,vector<pll>,greater<pll> > heap;
//macro
#define SZ(x) ((ll)(x).size())
#define ALL(x) (x).begin(),(x).end()
#define F first
#define S second
#define mkp make_pair
#define pb push_back
const ll INF=1e9;
const ll MAX=1e6+5;
const ll MOD=1e9+7;
//}}}
int mi[300];
int cnt[300];
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	for(int i='a';i<='z';i++)
		mi[i]=INF;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		for(char c:s)
			cnt[c]++;
		for(int i='a';i<='z';i++){
			mi[i]=min(mi[i],cnt[i]);
			cnt[i]=0;
		}
	}
	for(char i='a';i<='z';i++){
		for(int j=0;j<mi[i];j++){
			cout<<i;
		}
	}
	cout<< '\n';
	return 0;
}


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

int main(){
    int N, K, cnt = 0;
    cin >> N >> K;
    vector<int> heights(N);
    for(int i = 0; i < heights.size(); i++){
        cin >> heights[i];
    }
    for(int i = 0; i < heights.size(); i++){
        if(heights[i] >= K){
            cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <math.h>
int main(){
	double a[1010];
	int n;
	double m=0;
	double ans=0;
	int i;
	while(scanf("%d",&n),n!=0){
		m=0;
		ans=0;
		for(i=0;i<n;i++){
			scanf("%lf",&a[i]);
			m+=a[i];
		}
		m/=(double)n;
		for(i=0;i<n;i++){
			ans+=pow(a[i]-m,2.0);
		}
		ans/=(double)n;
		printf("%lf\n",sqrt(ans));
	}
	return 0;
}



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

#define ll long long
#define f first
#define s second

int main() {
    int a[3], b, c;
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    cout << abs(a[0] - a[1]) + abs(a[1] - a[2]);
    //cout << min(abs(a - b) + abs(b - c), min(abs(a - c) + abs(c - b),  abs(b - a) + abs(a - c)));
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <experimental/optional>

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

struct UnionFind{
    using W = int;

    std::vector<int> parent, rank;
    // weight[v]: v -> v が属する木の根へのパスの重み
    // 注意: 使う前に find(v) を実行する必要がある
    std::vector<W> weight;
    
    UnionFind(int n) : parent(n), rank(n, 0), weight(n, 0) {
        std::iota(parent.begin(), parent.end(), 0);
    }

    int find(int v){
        if(v == parent[v]){return v;}
        
        int r = find(parent[v]);
        weight[v] += weight[parent[v]];
        parent[v] = r;

        return r;
    }
    
    std::experimental::optional<W> pathWeight(int s, int t){
        if(find(s) != find(t)){
            return {};
        }

        return weight[s] - weight[t];
    }

    // s から t へ重み w の辺を付け加える
    // 戻り値: 辺を付け加えても整合性が保たれるか
    bool unite(int s, int t, W w){
        int r1 = find(s), r2 = find(t);

        if(r1 == r2){
            return weight[s] - weight[t] == w;
        }

        if(rank[r1] > rank[r2]){
            parent[r2] = r1;
            weight[r2] = -(w - (weight[s] - weight[t]));
        }else{
            parent[r1] = r2;
            weight[r1] = w - (weight[s] - weight[t]);
            if(rank[r1] == rank[r2]){rank[r2] += 1;}
        }

        return true;
    }
};

int N, M;

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

    std::cin >> N >> M;

    UnionFind uf(N + 1);
    bool can = true;
    
    for(int i=0;i<M;++i){
        int l, r, d;
        std::cin >> l >> r >> d;

        unless(uf.unite(l, r, d)){
            can = false;
            break;
        }
    }

    const std::string YESNO[] = {"No", "Yes"};
    std::cout << YESNO[can] << std::endl;
}


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint=long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;


class Graph{
public:
    Graph(llint graphsize):gsize(graphsize),edges(graphsize),dp(100100,-1){
        
    }
    void add_edgh_d(llint a,llint b){
        edges[a].push_back(b);
    }
    llint rec(llint v){
        if(dp[v]!=-1){
            return dp[v];
        }else{
            llint result = 0;
            for(auto x:edges[v]){
                result = max(result, rec(x) + 1);
            }
            return dp[v] = result;
        }

    }

private:
    vector<vector<llint>> edges;
    llint gsize;
    vector<long long int> dp;
};

int main(){
    llint n, m;
    cin >> n >> m;
    Graph graph(n);
    llint tmpa, tmpb;
    REP(i,m){
        cin >> tmpa >> tmpb;
        graph.add_edgh_d(tmpa-1, tmpb-1);
    }
    llint result = 0;
    REP(i,n){
        result = max(result, graph.rec(i));
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 8576
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);

    ll N, M;
    cin >> N >> M;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    vector<ll> S(N);
    map<ll, ll> mp;
    ll ans = 0;
    rep(i, N){
        if(!i) S[i] = A[i];
        else S[i] = A[i] + S[i-1];
        S[i] %= M;

        mp[S[i]]++;
        if(S[i] == 0) ans += mp[S[i]];
        else ans += mp[S[i]] - 1;
    }

    print(ans);

    return 0;
}

Measured memory_bytes: 5760
s = gets.chomp.to_s
t = gets.chomp.to_s

def rotate_string (s)
  s[-1] + s[0..-2]
end

ans = "No"

s.length.times do |index|
  s = rotate_string(s)
  if t == s
    ans = "Yes"
    break
  end
end

puts ans

Measured memory_bytes: 1788
def solve_eq(m, v)
  #print "m=", m.to_s, "\n", "v=", v.to_s, "\n"

  n = m.length
  ans = []

  for i in (0...n)
    max_i = (i...n).max { |k| m[k][i].abs }
    #puts max_i
    if (max_i != i)
      tmi = m[i]; m[i] = m[max_i]; m[max_i] = tmi
      tvi = v[i]; v[i] = v[max_i]; v[max_i] = tvi
    end


    mii = m[i][i]
    for j in (i...n)
      m[i][j] /= mii
    end
    v[i] /= mii

    for k in ((i + 1)...n)
      dki = m[k][i]
      for j in (i...n)
        m[k][j] -= dki * m[i][j]
      end
      v[k] -= dki * v[i]
    end
  end
  #print "m=", m.to_s, "\n", "v=", v.to_s, "\n"

  (n - 1).step(0, -1). each do |i|
    sum = 0
    ((i + 1)...n).each { |j| sum += m[i][j] * ans[j] }
    ans[i] = v[i] - sum
  end

  #print "ans=", ans, "\n"
  return ans
end

n = gets.chop.to_i

n.times do
  x1, y1, x2, y2, x3, y3 = gets.chop.split(/\s+/).map { |s| s.to_f }
  #puts [x1, y1, x2, y2, x3, y3].join(', ')

  mat = [ [x1, y1, 1], [x2, y2, 1], [x3, y3, 1] ]
  vec = [-(x1 * x1 + y1 * y1), -(x2 * x2 + y2 * y2), -(x3 * x3 + y3 * y3)]

  ans = solve_eq(mat, vec)
  #puts ans

  px = -ans[0] / 2
  py = -ans[1] / 2
  r = Math.sqrt(px * px + py * py - ans[2])

  printf("%.3f %.3f %.3f\n", px, py, r)
end

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

int main() {
  long n,m,ans=0;
  cin >> n >> m;
  vector<long> p(n);
  vector<long> x(m);
  vector<long> y(m);
  vector<vector<long>> aaa(n,vector<long>(0));
  vector<unordered_set<long>> a(n);
  vector<long> v(n,-1);
  for(long i=0;i<n;i++) cin >> p[i];
  for(long i=0;i<m;i++) cin >> x[i] >> y[i];

  for(long i=0;i<m;i++) {
    aaa[x[i]-1].push_back(y[i]-1);
    aaa[y[i]-1].push_back(x[i]-1);
  }

  for(long i=0;i<n;i++) {
    if(v[i]==-1) {
      queue<long> q;
      q.push(i);
      while(q.size()!=0) {
        a[i].insert(p[q.front()]-1);
        v[q.front()]=i;
        for(long j=0;j<aaa[q.front()].size();j++) {
          if(v[aaa[q.front()][j]]==-1) {
            q.push(aaa[q.front()][j]);
          }
        }
        q.pop();
      }
      if(a[i].count(i)) ans++;
    } else {
      if(a[v[i]].count(i)) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 19236
/*
    ????????°??§???????????¨????????????
*/

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <limits.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iterator>
#include <vector>
#include <map>
#include <utility>
#define LLU unsigned long long int
#define LL long long int
#define LD long double
using namespace std;
#define LLUmax ULLONG_MAX
#define LLmax LLONG_MAX
#define dmax INT_MAX
#define vd vector<int>
#define vLL vector<long long int>
#define vLLU vector<unsigned long long int> 
#define pb push_back
#define mp make_pair
#define fi first
#define sec second
#define debug printf("asd\n")
#define debugd(a) printf("--%d\n",a)
#define debugdd(a,b) printf("--%d %d\n",a,b)
#define debugarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i]);printf("\n")
#define newline printf("\n")
#define forin(a,b,c) for(int a=b ; a<c ; a++)
#define forde(a,b,c) for(int a=b ; a<c ; a--)


inline void scd(int &a){scanf("%d",&a);}
inline void scdd(int &a,int &b){scanf("%d %d",&a,&b);}
inline void sctd(int &a,int &b,int &c){scanf("%d %d %d",&a,&b,&c);}
inline void scdlld(long int &a,long int &b){scanf("%I64d %I64d",&a,&b);}
inline void sclld(long long int &a){scanf("%I64d",&a);}

#define scarrd(a,b) for(int i=0 ; i<b ; i++)scanf("%d",&a[i])
#define prdlld(a,b) printf("%I64d %I64d",a,b)
#define prdd(a,b) printf("%d %d",a,b)
#define prd(a) printf("%d",a)
#define prarr(a,b) for(int i=0 ; i<b ; i++)printf("%d ",a[i])
#define iniarr(a,b) for(int i=0 ; i<b ;i++)a[i]=0
#define arr(a,b) int *a=(int *)malloc(b*sizeof(int))
#define llarr(a,b) long long int *a=(long long int *)malloc(b*sizeof(long long int))
#define st(a,b) char *a=(char *)malloc(b*sizeof(char))
#define grav 9.8
#define pi 3.14159265

int main()
{
	char a[2000];
	char b[2000];
	int d=0;
	scanf("%s",b);
	int len=strlen(b);
	forin(i,0,len)
	{
		b[i]=toupper(b[i]);
	}
	scanf("%s",a);
	while(strcmp(a,"END_OF_TEXT")!=0)
	{
		len=strlen(a);
		forin(i,0,len)
		{
			a[i]=toupper(a[i]);
		}
		if(strcmp(a,b)==0)
		d++;
		
		scanf("%s",a);
	}
	printf("%d\n",d);
	return 0;
}

Measured memory_bytes: 3204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <climits>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <cstring>

// ---------- PBDS -----------------

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>

// ----------------------------------

using namespace std;
using namespace __gnu_pbds; 

#define MEM(a, b) memset(a, (b), sizeof(a))
#define ALL(a) a.begin(), a.end()
#define MP(a, b) make_pair(a, b)
#define PB(a) push_back(a)
#define EB(a) emplace_back(a) 
#define boost ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0),cout << fixed << setprecision(10);
// #define ll long long int
#define int long long int

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// debug & operator << (debug & dd, P p) { dd << "(" << p.x << ", " << p.y << ")"; return dd; }
#define deb(x) debug() << imie(x)

const int MOD =  1e9 + 7;

void solve(){
    
    int n;
    cin >> n;
    
    vector <int> v(n);
    
    int ans = 0;
    
    for(int i = 0; i < n; ++i){
        cin >> v[i];
    }
    int sum = 0;
    for(int i = 0; i < n; ++i){
        if(i){
            ans = (ans + (sum * v[i]) % MOD) % MOD;
        }
        sum = (sum + v[i]) % MOD;
    }
    
    cout << ans;
}

int32_t main(){

	boost;

	int T;
	
	//cin >> T;
	 T = 1;
	
	for(int i = 1; i <= T; ++i){
		solve();
		cout << "\n";
	}

	return 0;
}



Measured memory_bytes: 4780
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
int main()
{
	
	int n;
	long long sn, x, y;
	vector<long long>p;
	map<long, long>m;
	while (1){
		m.clear();
		p.clear();
		cin >> n;

		if (n == 0)break;
		for (int i = 0; i < n; i++){
		cin >> sn >> x >> y;
			if (m.find(sn) == m.end()){
				p.push_back(sn);
			}
				m[sn] += x*y;
		}
		int flag = 0;
		for (int i = 0; i < p.size(); i++){
			if (m[p[i]] >= 1000000){
				cout << p[i] << endl;
				flag++;
			}
		}
		if (flag==0)cout << "NA" << endl;
	}
}

Measured memory_bytes: 1284
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep_(i, a_, b_, a, b, ...) for (int i = (a), i##_len = (b); i < i##_len; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define reprev_(i, a_, b_, a, b, ...) for (int i = (b-1), i##_min = (a); i >= i##_min; --i)
#define reprev(i, ...) reprev_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
// template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main (void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t; cin >> s >> t;
    if (s.size() == t.size() - 1 && t.substr(0, s.size()) == s) cout << "Yes\n";
    else cout << "No\n";
    // cout << t.substr(0, s.size());
    return 0;
}

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

int main()
{
 int N,K; cin >> N >> K;
 vector<int> b;
 b.assign(N,1);
 for(int i=0;i<K;i++){
     int d; cin >> d;
     for(int j=0;j<d;j++){
         int a; cin >> a;
         b[a-1]=0;
     }
 }
 int ans=0;
 for(int i=0;i<N;i++){
     ans+=b[i];
 }
 cout << ans << endl;
 return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include <time.h>


int main(void){
    long n,i,a=1;
    scanf("%ld",&n);
    char s[100000];
    scanf("%s",s);
    // printf("%s",s);
    for(i=1;i<n;i++){
        if(s[i]!=s[i-1]) a++;
    }   


    printf("%ld\n",a);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cstdlib>
#include <typeinfo>


using namespace std;

const int INF = -1;

typedef pair<int, int> P;

const int MAX_H = 1000;
const int MAX_W = 1000;
char field[MAX_H][MAX_W + 1];
int d[MAX_H][MAX_W];
int H, W, N;
int sx, sy;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int bfs(){

  int time = 0;

  for (int i = 1; i <= N; i++) {

    for (int i = 0; i < H; i++)
      for (int j = 0; j < W; j++) d[i][j] = INF;

      queue<P> que;

      que.push(P(sx, sy));
      d[sx][sy] = 0;


      while (que.size()){

        P p = que.front(); que.pop();

        if (field[p.first][p.second]-'0' == i) {
          time += d[p.first][p.second];
          sx = p.first;
          sy = p.second;
          break;
        }

        for (int i = 0; i < 4; i++) {

          int nx = p.first + dx[i], ny = p.second + dy[i];

          if(0 <= nx && nx < H && 0 <= ny && ny < W && field[nx][ny] != 'X'&& d[nx][ny] == INF){
            que.push(P(nx, ny));
            d[nx][ny] = d[p.first][p.second] + 1;
          }
        }
      }
  }
  return time;
}


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

  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> field[i][j];
      if (field[i][j] == 'S'){
        sx = i;
        sy = j;
      }
    }
  }

  cout << bfs() << endl;
}

Measured memory_bytes: 8028
#include <iostream>
using namespace std;
int main(void){
    int a,b,c;
    cin>>a>>b>>c;
    if(a+c==b) cout<<"Yes"<<endl;
    else if(a+b==c) cout<<"Yes"<<endl;
    else if(b+c==a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
    
    
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int answer = 0;
    for (int i = 0; i < s.length() / 2; i++) {
        if (s[i] != s[s.length() - 1 - i]) ++answer;
    }
    cout << answer << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;

int main() {
int a,b;
double t;
cin >> a >> b >> t;
t += 0.5;
int ans = 0;
for (int i = a;i <= t;i += a) ans += b;

cout << ans << endl;

return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e5+5;
int n; 
ll a[N], b[N], c[N];
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%lld", a+i);
		b[i] = a[i]+i; c[i] = i-a[i];
	}
	sort(c+1, c+1+n);
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += upper_bound(c+1, c+1+n, b[i]) - lower_bound(c+1, c+1+n, b[i]);
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8484
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int 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
#include <bits/stdc++.h>
#define ll long long
using namespace std;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  ll vec[n];
  map<ll,int> ma;
  for(int i=0;i<n;i++){
    cin>>vec[i];
    ma[vec[i]]++;
  }
  if(ma[1]>0){
    if(ma[1]==1){
      cout<<1<<endl;
      return 0;
    }
    cout<<0<<endl;
    return 0;
  }
  sort(vec,vec+n);
  int ans=0;
  int p;
  for(int i=0;i<n;i++){
    p=0;
    if(ma[vec[i]]>1){
      continue;
    }
    if(i<sqrt(vec[i])){
      for(int j=0;j<i;j++){
        if(vec[i]%vec[j]==0){
          p++;
          break;
        }
      }
    }
    else{
      for(int j=2;j*j<=vec[i];j++){
      if(vec[i]%j==0){
        if(ma[j]>0||ma[vec[i]/j]>0){
          p++;
          break;
        }
      }
    }
    }
    if(p==0){
      ans++;
    }
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 43596
// Bismillahir Rahmanir Rahim
// AtCoder-Popular Vote

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

int main(){
 int n,m;
 cin>>n>>m;
 double arr[n+5],sum = 0;
 
 for(int i = 0; i < n; ++i){
 	cin>>arr[i];
 	sum += arr[i];
 }

 sort(arr,arr+n);
 double check = 1/(4*(double)m);
 int cnt = 0;
 for(int i = n-1; i >= 0; --i){

 	if(check*sum<=arr[i]){
 	  ++cnt;
	}
 	  if(cnt == m){
 	  	cout<<"Yes\n";
 	  	return 0;
	   }
 }
 cout<<"No\n";
 return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

void read();
template<typename First, typename... Rest> void read(First& first, Rest&... rest);
void write();
template<typename First, typename... Rest> void write(First first, Rest... rest);
template<typename T> void write_vec(vector<T>& v, char divider);

int main(){
    int N;
    read(N);
    vector<int> H(N);
    for(int i = 0; i < N; i++){
        read(H[i]);
    }
    int len = 0;
    int ans = 0;
    for(int i = 1; i < N; i++){
        if(H[i] <= H[i - 1]) len++;
        else {
            ans = max(ans, len);
            len = 0;
        }
    }
    ans = max(ans, len);
    write(ans);
    return 0;
}

//配列以外の入力を受け取る
void read(){

}
template<typename First, typename... Rest>
void read(First& first, Rest&... rest){
    cin >> first;
    read(rest...);
}
//
//配列以外を出力する
void write(){

}
template<typename First, typename... Rest>
void write(First first, Rest... rest){
    cout << first << " ";
    write(rest...);
}
//
//配列を区切って出力する
template<typename T>
void write_vec(vector<T>& v, char divider){
    for(size_t i = 0; i < v.size(); i++){
        cout << v[i] << divider;
    }
}
//

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

using namespace  std;

const int maxn = 1e5+10;
int n;
int dp[maxn][3];
int a[maxn], b[maxn], c[maxn];

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

	cin >> n;
	for(int i=0; i<n; i++)
		cin >> a[i] >> b[i] >> c[i];

	for(int i=0; i<n; i++){
		dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a[i];
		dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b[i];
		dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + c[i];
	}

	int ans = max(dp[n-1][0], dp[n-1][1]);
	ans = max(ans, dp[n-1][2]);

	cout << ans << endl;
}


Measured memory_bytes: 2560
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|s| s.parse().ok().unwrap())
        .collect()
}

const MOD: usize = 1_000_000_007;

fn main() {
    let input = read_vec::<usize>();
    let (n, m) = (input[0], input[1]);

    let mut aa = vec![false; n+1];
    for _ in 0..m {
        let a = read::<usize>();
        aa[a] = true;
    }

    let mut dp = vec![0usize; n+1];
    dp[0] = 1;

    for i in 0..n {
        if !aa[i+1] {
            dp[i+1] += dp[i];
            dp[i+1] %= MOD;    
        }
        if i < n - 1 && !aa[i+2] {
            dp[i+2] += dp[i];
            dp[i+2] %= MOD;
        }
    }

    println!("{:?}", dp[n]);
}

Measured memory_bytes: 4476
#include<bits/stdc++.h>
#define ll long long

const ll mod = 1000000007 ;

using namespace std ;

int main()
{
	string s;
	cin>>s;
	vector<int> v;
	int count = 0 ;
	for(int i=0 ; i<s.length() ; i++)
	{
		if(s[i]=='R' && s[i+1]!='S')
			count++ ;
		else if(s[i]=='R' && s[i+1]=='S')
		{
			v.push_back(count+1);
			count = 0 ;
		}
	}
	v.push_back(count);
	int maxi = *max_element(v.begin(),v.end());
	cout<<maxi;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define pr pair<int,int>
#define all(x) x.begin(),x.end()
#define mod 1000000007
const int INF = 1e9+5;

int main(){
  ios_base::sync_with_stdio(false);
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
  int n; cin>>n;
  vector<int> h(n);
  for(int &i:h)
    cin>>i;

  vector<int> dp(n,INF);
  dp[0]=0;
  for(int i=0;i<n;i++){
    for(int j:{i+1,i+2}){
      if(j<n)
        dp[j]=min(dp[j],dp[i]+abs(h[i]-h[j]));
    }
  }

  cout<<dp[n-1]<<"\n";
  return 0;
}

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

int main() {
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    
    for(int i=sx; i<tx; ++i) cout << 'R';
    for(int i=sy; i<ty; ++i) cout << 'U';
    for(int i=tx; i>sx; --i) cout << 'L';
    for(int i=ty; i>sy; --i) cout << 'D';

    cout << 'L';
    for(int i=sy; i<=ty; ++i) cout << 'U';
    for(int i=sx-1; i<tx; ++i) cout << 'R';
    cout << 'D';

    cout << 'R';
    for(int i=ty; i>=sy; --i) cout << 'D';
    for(int i=tx+1; i>sx; --i) cout << 'L';
    cout << 'U';

    cout << '\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
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...);
}
long long pows(long long a, long long b) {
  long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll powm(ll x,ll y,ll m=MOD){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){return powm(a,m-2,m);}int main()
{
fastIO
ll n,m,i,j,k,x,y,z,t,e,f,p,q,g,l,r,o,w,h,count1=0,prod=1,a,b,c,d,index,x1,x2,y1,y2,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
cin>>a>>b>>c>>d;
ll a1,a2,a3,a4;
a1=a*c;
a2=a*d;
a3=b*c;
a4=b*d;
ans=max({a1,a2,a3,a4});
cout<<ans<<"\n";
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define INF 100000000
using namespace std;

int main() {

    int N,maxans=0;
    cin>>N;
vector<vector<vector<int>>> A(N, vector<vector<int>>(15, vector<int>(2)));
    for(int i=0; i<N; i++){
      int k; cin>>k;
      for(int j=0; j<15-k; j++)A[i].pop_back();
      for(int j=0; j<k; j++){cin>>A[i][j][0]>>A[i][j][1];}}
  
  for(int i=0; i<(1<<N); i++){
    bitset<16> b(i);
    int ans=0;
    for(int j=0; j<N; j++){
      for(int k=0; k<A[j].size(); k++){
        if(b[A[j][k][0]-1]!=A[j][k][1]&&b[j]==1){goto here;}   
     }}
    ans=b.count();
    maxans=max(maxans,ans);
    here: ans=0;}
    cout << maxans << endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt(); //num of arrays
        Integer mountain[] = new Integer[N]; // array
        for (int i=0; i<N; i++) {
            mountain[i] = sc.nextInt();
        }
        int maxhight = 0;
        int seeview = 0;
        for (int i = 0; i< N; i++){
            if (maxhight <= mountain[i]) {
                seeview++;
                maxhight = mountain[i];
            }
        }
        System.out.println(seeview);
    }
}

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

V, E = map(int, input().split())
G = {i: deque([]) for i in range(V)}
for _ in range(E):
    v1, v2 = map(int, input().split())
    G[v1].append(v2)
    G[v2].append(v1)


seen = [0]*(V)
stack = []
color = {v: -1 for v in range(V)}

def dfs(j, col):
    global time
    if seen[j]:
        return
    seen[j] = 1
    stack.append(j)
    color[j] = col
    while stack:
        s = stack[-1]
        if not G[s]:
            stack.pop()
            continue
        g_NO  = G[s].popleft()
        if seen[g_NO]:
            continue
        color[g_NO] = col
        seen[g_NO] = 1
        stack.append(g_NO)
    
c = 0
for start in range(V):
    if seen[start]:
        continue
    dfs(start, c)
    c += 1


q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    if color[s] != -1 and color[t] != -1 and color[s] == color[t]:
        print("yes")
    else:
        print("no")


Measured memory_bytes: 98132
n = int(input())
d = list(list(map(int, input().split())) for _ in range(n))

for i in range(2):
    for j in range(n - 2):
        if d[j][0] == d[j][1] and d[j + 1][0] == d[j + 1][1] and d[j + 2][0] == d[j + 2][1]:
            print("Yes")
            exit()
print("No")


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define MOD 100000007
#define PI 3.141592653589793238
#define pb push_back
#define ALL(V) (V).begin(), (V).end()
#define rep(i, a, b) for(int i = (a); i < (b); ++i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long long int lint;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
ll gcd(ll a, ll b) { return (a % b == 0 ? b : gcd(b, a % b)); }
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
ll char_to_ll(char c) { return (int)(c - '0'); }
ll string_to_ll(string s) { return char_to_ll(atoi(s.c_str())); }
bool is_prime(ll x){ if(x <= 1) return false; for(ll i = 2; sqrt(i) <= x; i++) if(x % i == 0) return false; return true; }

ll choose2(ll N){
    return N * (N - 1) / 2;
}

int main(){
    ll N;
    cin >> N;
    VL A(N), M(N + 1);
    rep(i, 0, N) cin >> A[i];
    rep(i, 0, N) M[A[i]]++;
    ll total = 0;
    rep(i, 0, N + 1) total += choose2(M[i]);

    rep(k, 0, N){
        ll ans = total;
        ans -= choose2(M[A[k]]);
        ans += choose2(M[A[k]] - 1);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 5760
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int H = sc.nextInt();
			int W = sc.nextInt();
			int N = sc.nextInt();
			if ((H | W | N) == 0) return;
			int[][] f = new int[H][W];
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					f[i][j] = sc.nextInt();
				}
			}
			int[][] dp = new int[H][W];
			dp[0][0] = N - 1;
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (dp[i][j] > 0) {
						if (dp[i][j] % 2 == 0) {
							if (i + 1 < H) dp[i + 1][j] += dp[i][j] / 2;
							if (j + 1 < W) dp[i][j + 1] += dp[i][j] / 2;
						} else {
							if (i + 1 < H) dp[i + 1][j] += (f[i][j] == 0 ? 1 : 0) + dp[i][j] / 2;
							if (j + 1 < W) dp[i][j + 1] += (f[i][j] == 1 ? 1 : 0) + dp[i][j] / 2;
						}
					}
				}
			}

			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (dp[i][j] % 2 == 1) f[i][j] ^= 1;
				}
			}
			int h = 0;
			int w = 0;
			while (true) {
				if (h == H || w == W) {
					System.out.println(++h + " " + ++w);
					break;
				}
				if (f[h][w] == 1) w++;
				else h++;
			}
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

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

int main(){
  string s;
  cin >> s;
  int c = 0;
  rep(i,s.size()){if(s[i]=='1') c++;}
  cout << c << endl;
}


Measured memory_bytes: 256