akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
	static final double EPS = 0.00000000001;
	static final int COUNTER_CLOCKWISE = 1;
	static final int CLOCKWISE = -1;
	static final int ONLINE_BACK = 2;
	static final int ONLINE_FRONT = -2;
	static final int ON_SEGMENT = 0;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int q = scan.nextInt();
		for(int i = 0; i < q; i++) {
			double[]p0 = new double[2];
			double[]p1 = new double[2];
			double[]p2 = new double[2];
			double[]p3 = new double[2];
			p0[0] = scan.nextInt();
			p0[1] = scan.nextInt();
			p1[0] = scan.nextInt();
			p1[1] = scan.nextInt();
			p2[0] = scan.nextInt();
			p2[1] = scan.nextInt();
			p3[0] = scan.nextInt();
			p3[1] = scan.nextInt();
			double ans = getDistance(p0, p1, p2, p3);
			System.out.println(ans);
		}
		scan.close();
	}
	static int ccw(double[]p0, double[]p1, double[]p2) {
		double[]a = vec(p0, p1);
		double[]b = vec(p0, p2);
		if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
		if(cross(a, b) < -EPS) return CLOCKWISE;
		if(dot(a, b) < -EPS) return ONLINE_BACK;
		if(norm(a) < norm(b)) return ONLINE_FRONT;
		return ON_SEGMENT;
	}
	static boolean intersect(double[]p1, double[]p2, double[]p3, double[]p4) {
		if(ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0) {
			return true;
		}else {
			return false;
		}
	}
	static double getDistance(double[]a, double[]b, double[]c, double[]d) {
		if(intersect(a, b, c, d)) return 0.0;
		double t1 = getDistanceSP(a, b, c);
		double t2 = getDistanceSP(a, b, d);
		double t3 = getDistanceSP(c, d, a);
		double t4 = getDistanceSP(c, d, b);
		return Math.min(Math.min(t1, t2), Math.min(t3, t4));
	}
	static double getDistanceSP(double[]p1, double[]p2, double[]p) {
		double[]u1 = vec(p1, p2);
		double[]u2 = vec(p2, p1);
		double[]v = vec(p1, p);
		double[]w = vec(p2, p);
		if(dot(u1, v) < 0.0) return abs(v);
		if(dot(u2, w) < 0.0) return abs(w);
		return getDistanceLP(p1, p2, p);
	}
	static double getDistanceLP(double[]a, double[]b, double[]p) {
		double[]u = vec(a, b);
		double[]v = vec(a, p);
		double t1 = Math.abs(cross(u, v));
		double t2 = abs(u);
		return t1 / t2;

	}
	static double getDistance(double[]a, double[]b) {
		return abs(vec(a, b));
	}
	static double abs(double[]p) {
		return Math.sqrt(norm(p));
	}
	static double[] project(double[]p1, double[]p2, double[]p3) {
		double[]base = vec(p1, p2);
		double[]u = vec(p1, p3);
		double r = dot(u, base) / norm(base);
		double x = p1[0] + base[0]  * r;
		double y = p1[1] + base[1]  * r;
		double[]h = {x, y};
		return h;
	}
	static double norm(double[]p) {
		return p[0] * p[0] + p[1] * p[1];
	}
	static double[] vec(double[]p1, double[]p2) {
		double[]u = {p2[0] - p1[0], p2[1] - p1[1]};
		return u;
	}
	static double dot(double[]u, double[]v) {
		return u[0] * v[0] + u[1] * v[1];
	}
	static double cross(double[]u, double[]v) {
		return u[0] * v[1] - u[1] * v[0];
	}
}


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

int main() {

    int n, k, s;
    cin >> n >> k >> s;

    if(s!=1000000000){
        rep(i, k) cout << s << " ";
        rep(i, n-k) cout << 1000000000 << " "; 
        cout << endl;
    }
    else {
        rep(i, k) cout << 1000000000 << " ";
        rep(i, n-k) cout << 1 << " ";
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1280
n,y=map(int,input().split())
anslist=[]
for i in range(n+1):
    for j in range(n-i+1):
        if i*10000+j*5000+(n-i-j)*1000 == y :
            list=[i,j,n-i-j]
            anslist.append(list)
if len(anslist)>0:
    print("{} {} {}".format(anslist[0][0],anslist[0][1],anslist[0][2],))
else:
    print("{} {} {}".format(-1,-1,-1))

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <stack>
#include <string>
#include <iomanip>

int calculate(std::string str);
double arithmetic(double, double, char);

int main()
{
	std::string str;
	
	while (std::getline(std::cin, str)) calculate(str);
	
	return 0;
}

int calculate(std::string str)
{
	std::stringstream ss(str);
	std::stack<double> st;
	std::string s;
	
	while (ss >> s) {
		if (s.size() == 1) {
			switch (s.at(0)) {
			case '+':
			case '-':
			case '*':
			case '/':
				{
					double a = st.top();
					st.pop();
					double b = st.top();
					st.pop();
					st.push(arithmetic(b, a, s.at(0)));
					break;
				}
			default:
				st.push(s.at(0) - '0');
			}
		} else {
			std::stringstream stod(s);
			double temp;
			stod >> temp;
			st.push(temp);
		}
	}
	
	std::cout << std::setprecision(6) << std::setiosflags(std::ios::fixed) << st.top() << std::endl;
	
	return 0;
}

double arithmetic(double a, double b, char op)
{
	switch (op) {
	case '+':
		return a + b;
	case '-':
		return a - b;
	case '*':
		return a * b;
	case '/':
		if (b == 0.0) throw "0 devide";
		return a / b;
	default:
		throw "operator error";
	}
}

Measured memory_bytes: 1304
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;

const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    int a,b;
    cin >> a >> b;
    cout << (a==b?a*2:max(a,b)*2-1) << endl;
	return 0;
}

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

#define INF 1000000000000
#define MOD 1000000007

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

    int a1,a2,a3;
    cin>>a1>>a2>>a3;
    if(a1+a2+a3>=22){
        cout<<"bust"<<endl;
    }else{
        cout<<"win"<<endl;
    }
    return 0;
}

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

int main() {
	int x,y;
	cin >> x >> y;
	set<int>d1={1,3,5,7,8,10,12};
	set<int>d2={4,6,9,11};
	set<int>d3={2};
	string k = "No";
	if((d1.find(x)!=d1.end() && d1.find(y)!=d1.end())||
	   (d2.find(x)!=d2.end() && d2.find(y)!=d2.end())||
	   (d3.find(x)!=d3.end() && d3.find(y)!=d3.end()))
	{
		k = "Yes";
	}
    cout << k << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <bits/stdc++.h> 
using namespace std;
typedef int ll;

int maxim(int a,ll b,ll c){
    return max(max(a,b),c);    
}

int main(){
    int n;
    cin>>n;
    int total[n][3];
    int a[n][3];
    for(int i=0;i<n;i++){
        cin>>a[i][0]>>a[i][1]>>a[i][2];
    }
    total[0][0] = a[0][0];
    total[0][1] = a[0][1];
    total[0][2] = a[0][2];
    for(int i=1;i<n;i++){
        for(int j=0;j<3;j++){
            total[i][j] = max(total[i-1][(j+1)%3], total[i-1][(j+2)%3]) + a[i][j];
        }
    }
    cout<<maxim(total[n-1][0],total[n-1][1],total[n-1][2]);
}

Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int bubbleSort(int* A, int N)
{
    int kaisuu = 0;
    for (int i = 0; i < N - 1; i++) {
        for (int j = N - 1; j > i; j--) {
            if (A[j] < A[j-1]) {
                int tmp    = A[j];
                A[j]   = A[j-1];
                A[j-1] = tmp;
                kaisuu++;
            }
        }
    }
    return kaisuu;
}

int main(void)
{
    int N;
    cin >> N;
    int A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    int kaisuu = bubbleSort(A, N);

    for (int i = 0; i < N; i++) {
        cout << A[i];
        if (i != N - 1) {
            cout << " ";
        } else {
            cout << endl;
        }
    }
    cout << kaisuu << endl;

    return 0;
}

Measured memory_bytes: 3100
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int[][] a = new int[n - 1][3];
        for (int i = 0; i < n - 1; i++) {
            int c = Integer.parseInt(sc.next());
            int s = Integer.parseInt(sc.next());
            int f = Integer.parseInt(sc.next());
            a[i][0] = c;
            a[i][1] = s;
            a[i][2] = f;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n - 1; i++) {
            int temp = a[i][0] + a[i][1];
            for (int j = i + 1; j < n - 1; j++) {
                if (temp > a[j][1]) {
                    int temp2 = a[j][1];
                    while (temp > temp2) {
                        temp2 += a[j][2];
                    }
                    temp = temp2 + a[j][0];
                } else {
                    temp = a[j][0] + a[j][1];
                }
            }
            sb.append(temp);
            sb.append("\n");
        }
        sb.append("0\n");
        System.out.println(sb.toString());
    }
}

Measured memory_bytes: 24764
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	m := map[string]bool{}
	for _, c := range s {
		if m[string(c)] {
			fmt.Println("no")
			return
		}
		m[string(c)] = true
	}
	fmt.Println("yes")
}


Measured memory_bytes: 512
#include<iostream>
#include <algorithm>
#include<cstdio>
#include<string>
#include<math.h>
#include<vector>
#include <queue>
#include <bits/stdc++.h>
using namespace std;
typedef vector<vector<char>> field_t;

typedef pair<int, int> point_t;

bool judge(string S){
	int i;
	int N;
	N=S.length();
	for(i=0;i<N;i++){
		if(S.at(i)!=S.at(N-1-i))
		{
			return false;
		}
	}
	for(i=0;i<(N-1)/2-1;i++){
		if(S.at(i)!=S.at((N-1)/2-1-i))
		{
			return false;
		}
		if(S.at((N+3)/2-1+i)!=S.at((N-1-i)))
		{
			return false;
		}
	}
		return true;
}

int main()
{
	string S;
    cin >> S;
	if(judge(S)){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef pair<double,double> PDD;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

// aのp乗を求める関数
ll mpow(ll a, ll b){
	if(b==0){
		return 1;
	}else if(b%2==0){
		ll memo = mpow(a,b/2);
		return memo*memo%MOD;
	}else{
		return mpow(a,b-1)*a%MOD;
	}
}

int sum[4001][4001];
int b[4001][4001];

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



signed main(){
	int n,k; cin>>n>>k;
	CLR(b); CLR(sum);
	int t = k*2;
	rep(i,n){
		int x,y; char c; cin>>x>>y>>c;
		if(c=='B') b[x%t][y%t]++;
		else b[x%t][(y+k)%t]++;
	}
	int ans=0;
	rep(i,t*2+1)rep(j,t*2+1){
		b[i][j]=b[i%t][j%t];
	}

	rep(i,t*2+1)rep(j,t*2+1){
		sum[i][j]=b[i][j];
		if(j-1>=0) sum[i][j]+=sum[i][j-1];
		if(i-1>=0) sum[i][j]+=sum[i-1][j];
		if(i-1>=0&&j-1>=0) sum[i][j]-=sum[i-1][j-1];
	}

	rep(i,2*k+1)rep(j,2*k+1){
		ll tmp=0LL;
		tmp+=calc(i,j,i+k-1,j+k-1);
		tmp+=calc(i+k,j+k,i+2*k-1,j+2*k-1);
		chmax(ans,tmp);
	}
	cout<<ans<<endl;



	return 0;
}


Measured memory_bytes: 125312
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
num = [a,b,c,d,e]
count = 0
flg = True
for i in range(5):
    for j in range(i,5):
        if num[j] - num[i] > k:
            print(":(")
            flg = False
            break
    if not flg:
        break
else:
    print("Yay!")

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li n, k, q;
li cnt[100100];

int main() {
    cin >> n >> k >> q;
    rep(i, q) {
        li a;
        cin >> a;
        a--;
        cnt[a]++;
    }
    rin{
        li val = k - (q - cnt[i]);
        cout << (val > 0 ? "Yes" : "No") << endl;
    }


    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<n; i++)
#define FOR(i, s, n) for(int i=s; i<n; i++)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;

int main(){
    int N, M; cin >> N >> M;
    ll x[N], y[N], z[N];
    vector<ll> sum(N);
    int pm_x[8] = {-1, -1, -1, -1, 1, 1, 1, 1};
    int pm_y[8] = {-1, -1, 1, 1, -1, -1, 1, 1};
    int pm_z[8] = {-1, 1, -1, 1, -1, 1, -1, 1};
    REP(i, N){
        cin >> x[i] >> y[i] >> z[i];
    }
    ll maxans = -1;
    REP(i, 8){
        REP(j, N){
            sum[j] = pm_x[i]*x[j] + pm_y[i]*y[j] + pm_z[i]*z[j];
        }
        sort(sum.begin(), sum.end());
        ll ans = 0;
        REP(j, M){
            ans += sum[sum.size()-1-j];
            // ans += sum[j];
        }
        maxans = max(maxans, ans);
    }
    cout << maxans << endl;
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int N;
  ll K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<vector<ll>> jump(64, vector<ll>(N, 0));
  vector<int> b(200001, -1);
  int j = 1;
  dump(a);
  for (int j = 1, i = 0; i < N * 2; i++) {
    int t = b[a[i % N]];
    if (t < 0) {
      b[a[i % N]] = i;
    } else {
      if (t < N)
        jump[j][t] = i - t + 1;
      b[a[i % N]] = i;
    }
  }
  int mbit = 1;
  for (int j = 2; j < 64; j++) {
    for (int i = 0; i < N; i++) {
      ll t = jump[j - 1][i];
      jump[j][i] = jump[j - 1][(t + i) % N] + t;
    }
    if ((ll)N * K <= jump[j][0]) {
      mbit = j + 1;
      break;
    }
  }
  dumpv(jump, mbit, N);
  ll st = 0;
  for (int j = 63; 1 <= j; j--) {
    if (jump[j][st % N] == 0)
      continue;
    if (st + jump[j][st % N] < N * K) {
      st += jump[j][st % N];
    }
  }
  dump(st, N * K);
  st = st % N;

  int p = st;
  vector<int> ans;
  while (p < N) {
    if (p + jump[1][p % N] <= N) {
      p += jump[1][p % N];
    } else {
      ans.push_back(a[p]);
      p++;
    }
  }
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i] << " ";
  }
  cout << endl;

  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  while(getline(cin,s)){
    if(s == ".") break;
    bool f = true;
    stack<char> st;
    rep(i,s.size()){
      if(s[i] == '('){
        st.push('(');
      }
      if(s[i] == ')'){
        if(!st.size() || (st.size() && st.top() != '(')) f = false;
        if(st.size())st.pop();
      }
      if(s[i] == '['){
        st.push('[');
      }
      if(s[i] == ']'){
        if(!st.size() || (st.size() && st.top() != '[')) f = false;
        if(st.size())st.pop();
      }
    }
    if(f && !st.size()){
      cout << "yes"<<endl;
    }
    else{
      cout << "no"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 3020
#include <stdio.h>
void A(void);
void B(void);
void C(void);

int main(void){
    B();
    return 0;
}

void A(void){
    int a,b,c,k;
    scanf("%d %d %d",&a,&b,&c);
    printf("%d %d %d",c,a,b);
}

void B(void){
    int n,m,i,k=0;
    double sum=0;
    int array[1000];
    scanf("%d %d",&n,&m);
    for(i=0;i<n;i++){
        scanf("%d",&array[i]);
        sum+=array[i];
    }
    for(i=0;i<n;i++){
        if(array[i]>=sum/(4*m))k++;
    }
    if(k>=m){printf("Yes");
    }else{printf("No");}
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	bool ans=false;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='7')
			ans=true;
	}
	if(ans)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 3604
while gets
	cipher = $_.chomp.split
	while true
		0.upto(cipher.size-1) do |i|
			0.upto(cipher[i].size-1) do |j|
				cipher[i][j] = (cipher[i][j] == 'z') ? 'a' : (cipher[i][j].bytes[0]+1).chr if (/[a-zA-Z]/ =~ cipher[i][j])
			end
		end
		break if cipher.index("the") or cipher.index("this") or cipher.index("that")
	end
	puts cipher.join(" ")
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long



#if 0
const int MOD = ;

inline int lgput(int a, int b) {
    int ans = 1;
    while(b > 0) {
        if(b & 1) ans = (1LL * ans * a) % MOD;
        b >>= 1;
        a = (1LL * a * a) % MOD;
    }
    return ans;
}

inline void mod(int &x) {
    if(x >= MOD)
        x -= MOD;
}

inline void add(int &x, int y) {
    x += y;
    mod(x);
}

inline void sub(int &x, int y) {
    x += MOD - y;
    mod(x);
}

inline void mul(int &x, int y) {
    x = (1LL * x * y) % MOD;
}

inline int inv(int x) {
    return lgput(x, MOD - 2);
}
#endif

#if 0
int fact[], invfact[];

inline void prec(int n) {
    fact[0] = 1;
    for(int i = 1; i <= n; i++) {
        fact[i] = (1LL * fact[i - 1] * i) % MOD;
    }
    invfact[n] = lgput(fact[n], MOD - 2);
    for(int i = n - 1; i >= 0; i--) {
        invfact[i] = (1LL * invfact[i + 1] * (i + 1)) % MOD;
    }
}

inline int comb(int n, int k) {
    if(n < k) return 0;
    return (1LL * fact[n] * (1LL * invfact[k] * invfact[n - k] % MOD)) % MOD;
}
#endif

using namespace std;



int main() {
#if HOME
    ifstream cin("B.in");
    ofstream cout("B.out");
#endif
    int i, n;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;

    vector <int> l(n), r(n);
    int mxl = 0, mnr = 1e9, mx = 0;

    for(i = 0; i < n; i++) {
        cin >> l[i] >> r[i];
        mxl = max(mxl, l[i]);
        mnr = min(mnr, r[i]);
        mx = max(mx, r[i] - l[i] + 1);
    }

    if(n == 2) {
        cout << r[0] + r[1] - l[0] - l[1] + 2;
        return 0;
    }

    int ans = max(0, mnr - mxl + 1) + mx;

    vector <int> ord(n);
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](const int &x, const int &y) {
                if(max(0, r[x] - mxl + 1) == max(0, r[y] - mxl + 1)) return l[x] > l[y];
                return r[x] > r[y];
         });

    vector <int> suff(n + 1, 1e9);
    for(i = n - 1; i >= 0; i--) {
        suff[i] = min(suff[i + 1], max(0, mnr - l[ord[i]] + 1));
    }

    for(i = 0; i + 1 < n; i++) {
        ans = max(ans, suff[i + 1] + max(0, r[ord[i]] - mxl + 1));
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 1792
n = int(input())
XY = []
for i in range(n):
    x, y = map(int, input().split())
    XY.append((x, y))


# 外積、平行判定
def cross(a, b):
    return a.real * b.imag - b.real * a.imag


# 内積、直行判定
def dot(a, b):
    return a.real * b.real + a.imag * b.imag


# 外心の中心
def circumcenter(a, b, c):
    bunshi = (a - b) * dot(c, c) + (b - c) * dot(a, a) + (c - a) * dot(b, b)
    bunbo = (a - b) * c.conjugate() + (b - c) * a.conjugate() + (c - a) * b.conjugate()
    if bunbo == 0:
        return False, 0
    return True, bunshi / bunbo


kouho = []
for i in range(n - 1):
    a, b = XY[i]
    z1 = complex(a, b)
    for j in range(i + 1, n):
        c, d = XY[j]
        z2 = complex(c, d)
        kouho.append((z1 + z2) / 2)
if n >= 3:
    for i in range(n - 2):
        a, b = XY[i]
        z1 = complex(a, b)
        for j in range(i + 1, n - 1):
            c, d = XY[j]
            z2 = complex(c, d)
            for k in range(j + 1, n):
                e, f = XY[k]
                z3 = complex(e, f)
                flag, gaishin = circumcenter(z1, z2, z3)
                if flag:
                    kouho.append(gaishin)
ans = 10 ** 10
for z in kouho:
    temp = 0
    for i in range(n):
        x, y = XY[i]
        z1 = complex(x, y)
        temp = max(temp, abs(z - z1))
    ans = min(ans, temp)
print(ans)


Measured memory_bytes: 3876
#include<bits/stdc++.h>
using namespace std;
int a[1005];
int main()
{
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<k;i++)
	{
		sum+=a[i];
	}
	cout<<sum<<endl;
 } 

Measured memory_bytes: 3624
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=dict(Counter([i-j for i,j in enumerate(a)]))
c=dict(Counter([i+j for i,j in enumerate(a)]))
cnt=0
for i in b:
  cnt+=b[i]*c.get(i,0)
print(cnt)

Measured memory_bytes: 199032
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int INF = 1e10;
const long double PI = (acos(-1));


signed main() {
	int N, A, B;
	cin >> N >> A >> B;
	int num = N / (A + B);
	int ans = num * A;
	int sa = N - num * (A + B);
	ans += min(sa, A);
	cout << ans;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define oo (long long)1e18
#define ll long long
#define setdp memset(dp,-1,sizeof(dp))
const ll mod = 1e9+7;
void _IOS(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);cin.sync_with_stdio(0);}
#define PI 3.14159265359
int sx,sy,tx,ty;
//8c:1a:bf:89:66:b6
struct threeElements{
int _1st,_2nd,_3rd;
};
vector<vector<int>>adj(10);
ll v[200009];
int main()
{
   // freopen ("jumping.in","r",stdin);
   _IOS();
   //18:52
    string s,t;
    cin>>s>>t;
    if(s.length()>t.length())
        cout<<"GREATER";
    else if(s.length()<t.length())
        cout<<"LESS";
    else
    {
        for(int i=0;i<s.length();i++)
        {
            if(s[i]!=t[i])
            {
                if(s[i]>t[i])
                    return cout<<"GREATER",0;
                else
                    return cout<<"LESS",0;
            }
        }
        cout<<"EQUAL";
    }
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
const int MX = 100005;
int x, k, r[MX], q, t, a;
struct Sand{int xl, xr, yl, yr;} sd[MX][18];
int calc(Sand& a, int x){return min(a.yr, a.yl + max(0,x-a.xl));}
int rcalc(Sand& a, int y){return min(a.xr, a.xl + max(0,y-a.yl));}
Sand merge(Sand& a, Sand& b){
	int ml = max(b.xl,a.yl), mr = min(b.xr,a.yr);
	return (Sand){rcalc(a,ml),rcalc(a,mr),calc(b,ml),calc(b,mr)};
}
int main(){
	scanf("%d%d", &x, &k);
	rep(i,k){
		scanf("%d", r+i+1);
		int dr = r[i+1] - r[i];
		if(i&1) sd[i][0] = (Sand){0,max(0,x-dr),min(x,dr),x};
		else sd[i][0] = (Sand){min(x,dr),x,0,max(0,x-dr)};
	}
	for(int j = 1; j < 18; j++) rep(i,k) if(i + (1<<j) <= k){
		sd[i][j] = merge(sd[i][j-1],sd[i+(1<<(j-1))][j-1]);
	}
	scanf("%d", &q);
	rep(i,q){
		scanf("%d%d", &t, &a);
		int it = (int)(upper_bound(r,r+k+1,t) - r)-1, c = 0;
		for(int j = 0; it >> j; j++) if(it>>j&1){
			a = calc(sd[c][j],a);
			c += 1 << j;
		}
		if(it&1) a = min(x,a+t-r[it]);
		else a = max(0,a-(t-r[it]));
		printf("%d\n", a);
	}
}

Measured memory_bytes: 29696
process.stdin.resume();
process.stdin.setEncoding('utf8');

"use strict";
//x^2+y^2+z^2+xy+yz+zx=n
function calc(n) {
    let count=0
    for(let x=1; x*x<=n; x++) {
        for(let y=1; y*y<=n; y++) {
            const a = 1
            const b = x+y
            const c = x**2+y**2+x*y-n
            const judge = (b**2-4*a*c)
            if(judge>=0) {
                let z0 = (-b-judge**0.5)/(2*a)
                let z1 = (-b+judge**0.5)/(2*a)
                if(z0 >= 1 && z0===parseInt(z0,10))count++
                if(z1 >= 1 && z1===parseInt(z1,10))count++
                /*
                if(z1 >= 1 && z1===parseInt(z1,10)) count++
                */
                //console.log(`x=${x}, y=${y}, z0=${z0},z1=${z1}`)
                
            }            
        }
    }
    return count
}

function main(arg) {
    const n = parseInt(arg)
    for(let i=1; i<=n; i++) {
        //console.log(`-------i=${i}-------`)
        let ans = calc(i)
        console.log(ans)
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 37160
n, k = map(int, input().split())
p = list(map(int, input().split()))
d = [0 for _ in range(n)]

for i in range(len(p)):
    p[i] = 0.5*(p[i]+1)
d[0] = sum(p[0:k])
for i in range(1, n-k+1):
    d[i] = d[i-1] + p[i+k-1] -p[i-1]
print(max(d))

Measured memory_bytes: 25060
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, Y) for (int(X) = 0; (X) < (Y); ++(X))
#define rrep(X, Y) for (int(X) = (Y)-1; (X) >= 0; --(X))
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const long long MOD = 1000000007;

void solve(long long N, std::vector<long long> a, std::vector<long long> b) {
  priority_queue<pair<ll, char>> que;
  rep(n, N) {
    que.push(mp(a[n], 'a'));
    que.push(mp(b[n], 'b'));
  }

  ll ans = 1;
  ll num = 0;
  char c = 'x';
  while (!que.empty()) {
    auto p = que.top();
    if (num == 0) {
      num++;
      c = p.sc;
    } else {
      if (c == p.sc) {
        num++;
      } else {
        ans *= num;
        ans %= MOD;
        num--;
      }
    }
    que.pop();
  }
  print(ans);
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &a[i]);
  }
  std::vector<long long> b(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &b[i]);
  }
  solve(N, std::move(a), std::move(b));
  return 0;
}


Measured memory_bytes: 8048
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
int main(){
  startupcpp();
  ll i,N;
  cin>>N;
  vec v(500,0);
  v[4]=v[7]=v[8]=1;
  For(i,11,N+1){
    if(v[i-4]|v[i-7])v[i]=11;
  }
  if(v[N]) printyes;
  else printno;
  return 0;
}

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

  int N;
  
  cin >> N;
  
  int B[N - 1];
  
  cin >> B[0];
    
  int sum = B[0];
  
  for(int i = 1; i < N - 1; i++){
    cin >> B[i];
    if(B[i - 1] < B[i]){
      sum += B[i - 1];
    }else{
      sum += B[i];
    }
  }
  
  sum += B[N - 1 - 1];
  
  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 256
def main():
    n, m = [int(x) for x in input().rstrip("\n").split(" ")]

    from collections import defaultdict
    favorites = defaultdict(int)

    for i in range(n):
        k , *foods = [int(x) for x in input().rstrip("\n").split(" ")]
        for food in foods:
            favorites[food] += 1

    count = 0
    for food in range(1, m+1):
        if favorites[food] == n:
            count += 1
    print(count)

if __name__ == '__main__':
	main()
	

Measured memory_bytes: 3316
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int k,n; cin>>k>>n;
	if(n==100) n++;
	cout<<(n*fpow(100,k))<<"\n";
	return 0;
}





























Measured memory_bytes: 764
N = int(input())
H = list(map(int,input().split()))
for i in range(N-1,0,-1):
    if H[i] < H[i-1]:
        H[i-1] = H[i-1]-1
        if H[i] < H[i-1]:
            print("No")
            exit()
print("Yes")

Measured memory_bytes: 14396
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
sqrtn = sqrt(n)
for i in reversed(range(floor(sqrtn)+1)):
    if n % i == 0:
        a = int(n/i)
        print(a+i-2)
        exit()



Measured memory_bytes: 40172
#include<bits/stdc++.h>
#define MOD 1000000007
#define F first
#define S second

typedef long long ll;
using namespace std;


int n, m, lead, k;

int main()
{
//    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    scanf("%d", &n);
    if (n < 1200) puts("ABC");
    else if (n < 2800) puts("ARC");
    else puts("AGC");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    int x, y, z;
    cin >> x;

    if(x == 1){
        cout << "Hello World";
    }
    if(x == 2){
        cin >> y >> z;
        cout << y + z;
    }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;

long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)

long long modpow(long long m, long long n) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2);
        return t * t;
    } else {
        return modpow(m, n - 1) * m;
    }
}

long long moddiv(long long a, long long b) { return (a * modpow(b, mod - 2)) % mod; }

long long nCkmod(long long n, long long k) {
    long long denomi = 1;
    REP(i, n) {
        denomi *= (i + 1);
        denomi %= mod;
    }
    long long numera = 1;
    for (int i = n - k; i > 0; i--) {
        numera *= i;
        numera %= mod;
    }
    REP(i, k) {
        numera *= (i + 1);
        numera %= mod;
    }
    return moddiv(denomi, numera);
}

void print_binary(long long a) {
    for (int i = 31; i >= 0; i--) {
        cout << (a >> i & 1);
    }
    cout << endl;
}

void yes() {
    cout << "Yes" << endl;
    exit(0);
}
void no() {
    cout << "No" << endl;
    exit(0);
}
array<int, 101> factoring(int x) {
    array<int, 101> ret{};
    for (int i = 2; x >= i * i; i++) {
        while (x % i == 0) {
            ret[i]++;
            x /= i;
        }
    }
    if (x > 1) ret[x]++;
    return ret;
}

signed main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << min({a, b, c}) << " " << max({a, b, c}) << endl;
}


Measured memory_bytes: 3168
N = int(input().strip())

points = []

for i in range(0,N):
    points.append(list(map(int, input().strip().split())))

for cx in range(0,101):
    for cy in range(0,101):
        for p in points:
            if p[2] > 0:
                target = p
                break
        H = (target[2] + abs(target[0] - cx) + abs(target[1] - cy))
        if all([points[i][2] == max(H - (abs(points[i][0] - cx) + abs(points[i][1] - cy)),0) for i in range(0,N)]):
            res = [cx,cy,H]
            break


print(res[0],res[1],res[2])

Measured memory_bytes: 3064
def fun(a,n):
    if 0 in a:
        return 0
    z = 1
    for i in a:
        z=z*i 
        if(z>1000000000000000000):
            return -1
    return z

n = int(input())
a = list(map(int,input().split()))
f = fun(a,n)
print(f)


Measured memory_bytes: 21584
use strict;
my $N = <STDIN>;
my $line = <STDIN>;
my @L = split " ",$line;

@L = sort{$a <=> $b}@L;

my $count = 0;

for(my $i=0;$i<$N;++$i){
  $count += $L[2*$i];
}

print $count;


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

int main() {
 int N, K, X, Y;
  cin >> N >> K >> X >> Y;
  
  int i, j;
  if (N <= K) {
    i = X * N;
    j = 0;
  }
  else if (N > K) {
    i = X * K;
    j = Y * (N - K);
  }
  cout << i + j << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
#define all(f) (f).begin(),(f).end()
#define allr(f) (f).rbegin(),(f).rend()
const int mod = 1e9+7, A = 1e5+5;
ll fp(ll x, ll y)
{
	if (!y) return 1;
	ll acc = fp(x, y / 2);
	acc *= acc;
	return (y & 1) ? acc * x : acc;
}
int main()
{
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	ll n;
	cin >> n;
	ll t = n, ans = 0, d = 0;
	while (t)
		t /= 2, ans += fp(2, d++);
	cout << ans;
	return 0;
}


Measured memory_bytes: 256
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
Q = int(readline())
sum = sum(A)
d = [0]*(10**5+1)

for i in range(N):
    d[A[i]] += 1
    
for i in range(Q):
    B, C = map(int,readline().split())
    sum += (C-B)*d[B]
    d[C] += d[B]
    d[B] = 0
    print(sum)

Measured memory_bytes: 19128
#include <stdio.h>
#include <stdlib.h>
#define nrow 30
#define ncal 30

int main(void){
    int N, M, i, j, count, ans, num;
    int A[nrow][ncal];
    int mat[nrow][ncal]={0};
    int *K;
    //int *count;

    scanf("%d %d", &N, &M);
    K=(int*)malloc(sizeof(int)*M);
    //count=(int*)malloc(sizeof(int)*(M+1));

    for(i=0;i<N;i++){
        scanf("%d", &K[i]);
        for(j=0;j<K[i];j++){
            scanf("%d ", &A[i][j]);
        }
    }

    /*for(i=0;i<M+1;i++){
        count[i]=0;
    }

    for(i=0;i<N;i++){
        for(j=0;j<K[i];j++){
            for(judge=1;judge<=M;judge++){
                if(A[i][j]==judge){
                    count[judge]+=1;
                }
            }
        }
    }
    free(K);

    ans=0;
    for(i=1;i<M+1;i++){
        if(count[i]==N){
            ans+=1;
        }
    }
    free(count);*/

    for(num=1;num<=M;num++){
        for(i=0;i<N;i++){
            for(j=0;j<K[i];j++){
                if(A[i][j]==num){
                    mat[i][num-1]=num;
                    break;
                }
            }
        }    
    }
    //free(K);

    ans=0;
    for(num=1;num<=M;num++){
        count=1;
        for(i=0;i<N;i++){
            if(mat[i][num-1]!=num){
                count=0;
                break;
            }
        }
        ans+=count;
    }
    
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();

		if (a == b) {
			System.out.println("Draw");
		} else if (a == 1) {
			System.out.println("Alice");
		} else if (b == 1) {
			System.out.println("Bob");
		} else if (a > b) {
			System.out.println("Alice");
		} else {
			System.out.println("Bob");
		}

	}
}


Measured memory_bytes: 22740
import itertools
import math

n, m = [int(i) for i in input().split()]
town = [[0 for _ in range(n+1)] for _ in range(n+1)]

for i in range(m):
    a, b = [int(i) for i in input().split()]
    town[a][b] = 1
    town[b][a] = 1

lis =[i for i in range(1,n+1)]
permutations_lis = itertools.permutations(lis)

count = 0
for one_case in permutations_lis:
    if (one_case[0] == 1):
        flag = 1
    else:
        flag = 0

    for i in range(n-1):
        if(town[one_case[i]][one_case[i+1]] == 0):
            flag = 0
    if(flag == 1):
        count += 1

print(count)

Measured memory_bytes: 3064
use std::cmp;
use std::fmt::Debug;
use std::str::FromStr;
#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where
    T: FromStr,
    <T as FromStr>::Err: Debug,
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim()
        .split_whitespace()
        .map(|c| T::from_str(c).unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_as_string() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn solve(n: usize, k: usize, a: Vec<u128>) {
    for i in k..n {
        if a[i - k] >= a[i] {
            println!("No");
        } else {
            println!("Yes");
        }
    }
}

fn main() {
    let line = read_as_vec::<usize>();
    let (n, k) = (line[0], line[1]);
    let a = read_as_vec::<u128>();
    //solve(200000, 199999, vec![1_000_000_000; 200000]);
    solve(n, k, a);
}


Measured memory_bytes: 7408
import java.util.*;
import java.io.*;

public class Main{

	public static void main(String[] args) throws IOException {
		int N = readInt();
		HashSet<Integer> set = new HashSet<Integer>();
		
		for(int i = 1; i<=N; i++) set.add(readInt());
		
		println(set.size());
		
		exit();
	}

	static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	static StringTokenizer st;

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine().trim());
		return st.nextToken();
	}

	static long readLong() throws IOException {
		return Long.parseLong(next());
	}

	static float readFloat() throws IOException {
		return Float.parseFloat(next());
	}

	static boolean readBoolean() throws IOException {
		return Boolean.parseBoolean(next());
	}

	static short readShort() throws IOException {
		return Short.parseShort(next());
	}

	static byte readByte() throws IOException {
		return Byte.parseByte(next());
	}

	static int readInt() throws IOException {
		return Integer.parseInt(next());
	}

	static double readDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static char readCharacter() throws IOException {
		return next().charAt(0);
	}

	static String readLine() throws IOException {
		return br.readLine().trim();
	}

	static PrintWriter pr = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

	static void print(String s) {
		pr.print(s);
	}

	static void print(int s) {
		pr.print(s);
	}

	static void print(long s) {
		pr.print(s);
	}

	static void print(boolean s) {
		pr.print(s);
	}

	static void print(short s) {
		pr.print(s);
	}

	static void print(byte s) {
		pr.print(s);
	}

	static void print(double s) {
		pr.print(s);
	}

	static void print(char s) {
		pr.print(s);
	}

	static void print(float s) {
		pr.print(s);
	}

	static void println(String s) {
		pr.println(s);
	}

	static void println(int s) {
		pr.println(s);
	}

	static void println(long s) {
		pr.println(s);
	}

	static void println(boolean s) {
		pr.println(s);
	}

	static void println(short s) {
		pr.println(s);
	}

	static void println(byte s) {
		pr.println(s);
	}

	static void println(double s) {
		pr.println(s);
	}

	static void println(char s) {
		pr.println(s);
	}

	static void println(float s) {
		pr.println(s);
	}

	static void flush() {
		pr.flush();
	}

	static void exit() throws IOException {
		br.close();
		pr.close();
		System.exit(0);
	}
}


Measured memory_bytes: 22612
#pragma GCC optimize("Ofast")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define SZ(n)       ((int)(n).size())
#define all(n)      (n).begin(), (n).end()
#define anal           '\n'
#define mod         1000000007
#define fst         first
#define sec         second
#define pr(n)       cerr << n  << " ";
#define pfor(a)       for(auto (w) : (a)) pr(w)
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
        freopen("input.in", "r", stdin);
        freopen("output.in", "w", stdout);
#endif 
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
      
     int n;
     cin >> n;
     string s;
     cin >> s;
     int ans = 0;
     int l = 0, r = n - 1;
     while(l < r){
          
           if(s[l] == 'W' && s[r] == 'R'){
               ans++;
               swap(s[l], s[r]);
               l++;
               r--;
               continue;
           }
           if(s[l] == 'R') l++;
           if(s[r] == 'W') r--;
     }
     cout << ans << anal;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
//printclock; 
return  0 ;      
}        



      

Measured memory_bytes: 3728