akhauriyash/Code-Regression huggingface dataset:
<?php
fscanf(STDIN,"%d %d %d %d",$a,$b,$c,$K);
/*
$a(+1)が0になるまで$aを引き、
$aが0になったらなったら$b(+0)が0になるまで引き、
$bが0になったら$c(-1)を0になるまで引く
*/
$n = 0; //出力値を初期化

//もし$K（引く数）よりも$a+$bが大きかったら$n = $K
// $K-$aが0以下だったら$nは1*$a
// $K-$aが1以上、かつ$K-$bが0以下だったら$nは1*$a (+ 0*$b) ※0*$bは0なので無視
// $K-$aが1以上、かつ$K-$bが1以上だったら$nは1*$a + (-1)*$c (+ 0*$b)

if($K < $a+$b){
    $n = $K;
}elseif($K-($a+$b) < 1){ 
    $n = $a;
}else{
    $n = $a + (-1 * ($K-($a+$b)));
}
echo $n;
?>

Measured memory_bytes: 16228
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll=long long;
using vi = vector<int>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n;
    cin >> n;
    vi a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    vi b;
    rep(i,n-1){
        if(i+1==n || i==n) break;
        if(a[i]==a[i+1]){
            //cout << a[i] << endl;
            b.push_back(a[i]);
            i++;
        }
    }
    ll ans = 0;
    if(b.size()<=1){
        ans = 0;
    }else{
        sort(b.begin(),b.end(),greater<int>());
        ans = (ll)b[0] * (ll)b[1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>

using namespace std;


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int (i)=(n); (i)>=(0); (i)--)
#define SIZE(x) ((int)(x).size())
#define GCD(a, b) int gcd(int a,int b){return b?gcd(b,a%b):a;}
#define QP(a, b) int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define all(v) (v).begin(),(v).end()


template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
template<typename A, size_t N, typename T>
void FILL(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

typedef vector<int, int> vint;
typedef pair<int,int> pint;
typedef vector<pint>vpint;
typedef long long ll;

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1LL << 60;
const ll MOD = 1000000007LL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    vector<int> X(10000);
    for(int x=1; x<n; x++){
        for(int y=1; y<n; y++){
            for(int z=1; z<n; z++){
                long long N = (x+y)*(x+y) + (y+z)*(y+z) + (z+x)*(z+x);
                if(n < N/2) break;
                X[N/2]++;
            }
        }
    }
    for(int i=1; i<=n; i++) cout << X[i] << endl;
    return 0;
}

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

const int N = 1e6+10;

int up[N],d[N];

int main()
{
    int n;
    string s;
    cin>>s;
    int len = s.length(),ans = 0;
    if (len == 1)
    {
        cout<<min((10 - (s[0] - 48) + 1),s[0]-48);
        return 0;
    }
    up[0] = 10 - (s[0] - 48);
    d[0] = s[0] - 48;
    up[0] = min(up[0],d[0] + 1);
    for (int i = 1;i<len;i++)
    {
        int a = s[i] - 48;
        if (a <= 4) d[i] = up[i-1] + a + 1;
        else d[i] = up[i-1] + (10 - a);
        d[i] = min(d[i],d[i-1] + a);
        a++;
        up[i] = d[i-1] + a;
        if (a <= 4) up[i] = min(up[i],up[i-1] + a + 1);
        else up[i] = min(up[i],up[i-1] + (10 - a));
        
    }
    cout<<d[len-1];
    return 0;
}

Measured memory_bytes: 9220
import java.util.*;
import java.io.*;
class Main{
	public static void main(String[]args){
		Scanner in=new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out, true);
		int t = Integer.parseInt(in.nextLine());
		int count_1 = 0;
		int count_2 = 0;
		int count_3 = 0;
		int count_4 = 0;
		for(int i=0;i<t;i++){
			String str = in.nextLine();
			if(str.equals("AC"))
				count_1++;
			else if(str.equals("WA"))
				count_2++;
			else if(str.equals("TLE"))
				count_3++;
			else
				count_4++;
		}
		out.println("AC x " + count_1);
		out.println("WA x " + count_2);
		out.println("TLE x " + count_3);
		out.println("RE x " + count_4);
	}
}	


Measured memory_bytes: 61524
N = int(input())

xyp = []
xym = []

for _ in range(N):
    x, y = map(int, input().split())
    xyp.append(x+y)
    xym.append(x-y)
    
xyp.sort()
xym.sort()

print(max(xyp[-1] - xyp[0], xym[-1] - xym[0]))

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

#define fi first
#define se second
#define pb push_back
#define lson o<<1
#define rson o<<1|1
#define CLR(A, X) memset(A, X, sizeof(A))
#define bitcount(X) __builtin_popcountll(X)
typedef long long LL;
typedef pair<int, int> PII;
const double eps = 1e-10;
const LL MOD = 1e9+7;
const auto INF = 0x3f3f3f3f;
int dcmp(double x) { if(fabs(x) < eps) return 0; return x<0?-1:1; }

const int MAXN = 2e5+5;

int a[MAXN], b[MAXN], c[MAXN<<1], num[MAXN<<1];

int main() {
    int n, m;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
        c[i] = a[i];
    }
    scanf("%d", &m);
    for(int i = 0; i < m; i++) {
        scanf("%d", &b[i]);
        c[i+n] = b[i];
    }
    int k = n+m;
    sort(c, c+k);
    k = unique(c, c+k)-c;
    for(int i = 0; i < n; i++) {
        a[i] = lower_bound(c, c+k, a[i])-c;
        num[a[i]]++;
    }
    bool flag = 1;
    for(int i = 0; i < m; i++) {
        b[i] = lower_bound(c, c+k, b[i])-c;
        num[b[i]]--;
        if(num[b[i]] < 0) flag = 0;
    }
    printf("%s\n", flag?"YES":"NO");
    return 0;
}



Measured memory_bytes: 4096
#include<iostream>
using namespace std;
int main(){
  int A;
  cin >> A;
  bool flag = false;
  for(int i=1; i<=9; i++){
    for(int j=1; j<=9; j++){
      if(i*j == A){
        flag = true;
      }
    }
  }
  if(flag == true) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 888
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String[] arr = reader.readLine().split (" ");
        int X, Y, Z;
        X = Integer.parseInt (arr[0]);
        Y = Integer.parseInt (arr[1]);
        Z = Integer.parseInt (arr[2]);
        System.out.println (Z + " " + X + " " + Y);
    }
}

Measured memory_bytes: 23124
//#define TIMER_
#include <bits/stdc++.h>
using namespace std;
#define rep(i,r) for(int i = 0; i < (r); i++)
#define pb push_back
#define ALL(a) a.begin(), a.end()
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
using ll = long long;
using ull = unsigned long long;
int n; ll k;
int main() {
  fastio;
  cin >> n >> k;
  vector<ll> a(n + 1);
  vector<bool> visit(n+1, false);
  vector<ll> res;
  rep(i,n) cin >> a[i + 1];
  int curr = 1;
  while(!visit[curr]) {
    visit[curr] = true;
    res.push_back(curr);
    curr = a[curr];
  }
  ll sz = res.size(), i = 0;
  for (; i < sz; i++) {
    if (res[i] == curr) break;
  }
  if (i == sz) { 
    i = 0;
  }
  ll period = sz - i;
  // cout << i << " " << period << endl;
  if (k < i) { 
    cout << res[k] << endl;
    return 0;
  } else {
    k -= i;
    cout << res[k % period + i] << endl;
  }
  
  #ifdef TIMER_
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
  #endif
}


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

int main() {
	int N; cin >> N;
	vector<int> prime;
	bool flag;
	for(int i=2; i<1100; ++i){
	    flag=true;
	    for(int j=0; j<prime.size(); ++j){
	        if(i%prime[j]==0){
	            flag=false;
	            break;
	        }
	    }
	    if(flag) prime.push_back(i);
	}
	long ans=1, mul;
	int fd;
	for(int i=0; prime[i]<=N; ++i){
	    mul=1;
	    fd=N;
	    while(fd>0){
	        mul += fd/prime[i];
	        fd /= prime[i];
	    }
	    ans=(ans*mul)%1000000007;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;

namespace ABC148D
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Cin.Long();
            long[] a = Cin.LArr();
            var solver = new Solver(n, a);

            Console.WriteLine(solver.Solve());
        }
    }

    class Solver
    {
        private long N;
        private long[] A;
        public Solver(long n, long[] a)
        {
            N = n;
            A = a;
        }

        public IConvertible Solve()
        {
            long search = 1;
            for (int i = 0; i < N; i++)
            {
                if (A[i] == search)
                {
                    search++;
                }
            }

            if (search == 1)
            {
                return -1;
            }
            return N - search + 1;
        }
    }

    internal static class Cin
    {
        public static string String()
        {
            return Console.ReadLine();
        }

        public static int Int()
        {
            return int.Parse(String());
        }

        public static int[] IArr()
        {
            return Split().Select(int.Parse).ToArray();
        }

        public static long Long()
        {
            return long.Parse(String());
        }

        public static long[] LArr()
        {
            return Split().Select(long.Parse).ToArray();
        }

        public static double Double()
        {
            return double.Parse(String());
        }

        public static double[] DArr()
        {
            return Split().Select(double.Parse).ToArray();
        }

        private static IEnumerable<String> Split()
        {
            return String().Split(' ');
        }
    }
}

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

int main (){
	char A,B;
	cin >> A >> B;
	if(A == 'H'){
		if(B == 'H') cout << "H";
		else cout << "D"<<endl;

	}
	else{if(B == 'H') cout << "D";
		else cout << "H"<<endl;}
}

Measured memory_bytes: 256
// dfmt off
T lread(T=long)(){return readln.chomp.to!T;}T[] lreads(T=long)(long n){return iota(n).map!((_)=>lread!T).array;}
T[] aryread(T=long)(){return readln.split.to!(T[]);}void arywrite(T)(T a){a.map!text.join(' ').writeln;}
void scan(L...)(ref L A){auto l=readln.split;foreach(i,T;L){A[i]=l[i].to!T;}}alias sread=()=>readln.chomp();
void dprint(L...)(lazy L A){debug{auto l=new string[](L.length);static foreach(i,a;A)l[i]=a.text;arywrite(l);}}
static immutable MOD=10^^9+7;alias PQueue(T,alias l="b<a")=BinaryHeap!(Array!T,l);import std;
// dfmt on

void main()
{
    long N = lread();
    auto A = aryread();
    auto B = aryread();
    if (A == B)
    {
        writeln("Yes");
        return;
    }
    long s;
    foreach (i; 0 .. N)
        s += max(0, A[i] - B[i]);
    long t;
    foreach (i; 0 .. N)
    {
        long x = max(0, B[i] - A[i]);
        t += x / 2;
    }
    writeln(s <= t ? "Yes" : "No");
}


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

int main(){
    bool flag = true;
    string n; cin >> n;

    for(int i = 1; i < n.size(); i++){
        if(n[i] != '9'){ flag = false; }
    }
    if(flag){
        cout << 9 * (n.size() - 1) + (n[0] - '0') << endl;
        return 0;
    }

    if(n[0] > '1'){
        cout << 9 * (n.size() - 1) + (n[0] - '0') - 1 << endl;  
    }else{
        cout << 9 * (n.size() - 1) << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
    return powmod(a, MOD-2);
}
ll f[5000001], invf[5000001];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i%MOD;
    invf[n]=inv(f[n]);
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
}
ll comb(int x, int y){
    if(!(0<=y && y<=x)) return 0;
    return f[x]*invf[y]%MOD*invf[x-y]%MOD;
}
int main()
{
    int n;
    cin>>n;
    fac(n/2);
    ll p2[5000050];
    p2[0]=1;
    for(int i=1; i<=n/2; i++) p2[i]=p2[i-1]*2%MOD;
    ll s[5000050];
    s[0]=0;
    for(int i=0; i<=n/2; i++){
        s[i+1]=(s[i]+comb(n/2, i)*p2[n/2-i])%MOD;
    }
    ll ans=0;
    for(int i=0; i<=n/2; i++){
        (ans+=comb(n/2, i)*p2[n/2-i]%MOD*(s[n/2+1]-s[n/2-i+1]+MOD))%=MOD;
    }
    ans=ans*2%MOD;
    ll p3=1;
    for(int i=0; i<n; i++) p3=p3*3%MOD;
    ans=(p3-ans+MOD)%MOD;
    cout<<ans<<endl;
    return 0;
}

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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main(int argc, char *argv[]) {
    ll n;
    cin >> n;

    if (n % 2 == 0) MSG(pow(n / 2, 2))
    else
        MSG(n / 2 * (n / 2 + 1))

    return 0;
}



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

using namespace std;
using ll = long long;

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  rep(i, n - 1) {
    int a;
    cin >> a;
    --a;
    ++d[a];
  }

  rep(i, n) { cout << d[i] << endl; }
  return 0;
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
#define N 100005
#define int long long
using namespace std;
int n,m,a[N],cnt[N],tot;
char c[N];
bool b[N];
signed main(){
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	bool bo=1;
	for(int i=1;i<=n;i++){
		if(i==1&&a[i])a[i]--;
		else{
			if(a[i]-1>=a[i-1])a[i]--;
			else if(a[i]<a[i-1]){bo=0;break;}
		}
	}
	if(bo)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 1024
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h"
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LLONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
using psi = pair<string, int>;
// functions

#endif

int main_C() {
    std::cin.tie(0);
    ios::sync_with_stdio(false);

    int A, B, C, D, E, F; 
    cin >> A >> B >> C >> D >> E >> F;

    // 100A*i + 100B*j + C*k + D*l <= F
    // (C*k+D*l)/(100A*i+100B*j) <= E/100

    const int JMAX = F / (100 * B);
    const int IMAX = F / (100 * A);

    int ansWt = 100 * A, ansSg = 0;
    REP(j,JMAX+1) {
        REP(i,IMAX+1) {
            int water = 100 * A*i + 100 * B*j;
            if (water > F) continue;

            int SgMax = water/100 * E;
            const int KMAX = SgMax / C;
            const int LMAX = SgMax / D;
            REP(l,LMAX+1) {
                REP(k,KMAX+1) {
                    int sugar = C * k + D * l;

                    if (water + sugar <= F &&
                        (100+E)*(sugar) <= E*(water+sugar)){

                        // sugar/(water+sugar) > ansSg/(ansWt+ansSg)
                        if (sugar*(ansWt+ansSg) > ansSg*(water+sugar)) {
                            ansWt = water;
                            ansSg = sugar;
                        }
                    }
                }
            }
        }
    }

    cout << ansWt + ansSg << " " << ansSg << endl;

    return 0;
}


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

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

  for(int i=0;i<n;i++){
    sum+=arr[i];

  }
  float min;
  min = sum/(4*m);
  int flag=0;
  for(int i=0;i<n;i++){
    if(arr[i]>=min){
      flag+=1;

    }
  }
  if(flag>=m){
    cout<<"Yes"<<endl;

  }
  else{
    cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int

int main()
{
   int X , Y;
   scanf("%d %d",&X,&Y);
   int res = X + Y/2;
   printf("%d",res);
  return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(), v.end()
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define um unordered_multiset
#define us unordered_set
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define cc continue
#define bb break
#define rem 1000000007
//fflush(stdin);
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    string s,t;
    cin>>s>>t;
    ll dp[s.length()+1][t.length()+1];
    rep (i,0,s.length()+1)
    {
        dp[i][0]=0;
    }
    rep (i,0,t.length()+1)
    {
        dp[0][i]=0;
    }
    rep (i,1,s.length()+1)
    {
        rep (j,1,t.length()+1)
        {
            if (s[i-1]==t[j-1])
            {
                dp[i][j]=dp[i-1][j-1]+1;
            }
            else
            {
                dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
            }
            
        }
    }
    // rep (i,0,s.length()+1)
    // {
    //     rep (j,0,t.length()+1)
    //     {
    //         cout<<dp[i][j]<<" ";
    //     }
    //     cout<<"\n";
    // }
    deque <char> ans;
    ll x=t.length(),y=s.length();
    while (true)
    {
        if (x==0||y==0)
        bb;
        if (t[x-1]==s[y-1])
        {
            ans.pf(s[y-1]);
            x-=1;
            y-=1;
        }
        else
        {
            if (dp[y-1][x]>dp[y][x-1])
            {
                y=y-1;
            }
            else
            {
                x=x-1;
            }
        }
    }
    for (auto x: ans)
    {
        cout<<x;
    }
    cout<<"\n";
}


Measured memory_bytes: 70656
import java.math.BigDecimal;
import java.util.Scanner;

class Main {
	static double area(double[] x, double[] y){
		double area = 0;
		double crossp;
		
		for(int i = 0; i < x.length - 1; i ++){
			crossp = CrossPoint(x[i], y[i], x[i + 1], y[i + 1]);
			
			if(crossp == 200000){
				area += (y[i + 1] + y[i]) * (x[i + 1] - x[i]) / 2.0;
			}else{
				area += (crossp - x[i]) * y[i] / 2;
				area += (x[i + 1] - crossp) * y[i + 1] / 2;
			}
		}
		
		return Math.abs(area);
	}
	
	static double CrossPoint(double x0, double y0, double x1, double y1){ //notCros:return 20000
		if(y0 * y1 < 0){
			if(y1 == y0){
				return x0;
			}else{
				return x0 - y0 * (x1 - x0) / (y1 - y0);
			}
		}else{
			return 200000;
		}
	}
	
    public static void main(String[] args){
    	Scanner in = new Scanner(System.in);
    	int n = in.nextInt();
    	double[] x = new double[n + 1];
    	double[] y = new double[n + 1];
    	
    	for(int i = 0; i < n; i ++){
    		x[i] = in.nextInt();
    		y[i] = in.nextInt();
    	}

		x[n] = x[0];
		y[n] = y[0]; //??????????????£???????????????
    	
    	System.out.printf("%.1f\n", BigDecimal.valueOf(area(x, y)));
	}
}

Measured memory_bytes: 26872
//
//  main.cpp
//  adsfdsgsg
//
//  Created by h3037175 on 2017/07/31.
//  Copyright ?? 2017??´ h3037175. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <math.h>
#include<algorithm>
#include <utility>
#define nan -100000
using namespace std;
int main() {
    int ans=0,n,p[3],memo[1000][3],count=0;
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>p[j];
        }
        sort(p,p+3);
        for(int k=0;k<3;k++){
            memo[i][k]=p[k];
        }
    }
    for(int i=0;i<n;i++){
        for(int k=i+1;k<n;k++){
        for(int j=0;j<3;j++){
            if( memo[k][j]==nan){
                break;
            }
            if(memo[i][j]==memo[k][j] ){
                count++;
            }
        }
        if(count==3){
        ans++;
            memo[k][0]=nan;
        }
        count=0;
    }
    }
    cout<<ans<<endl;
    return 0;
}

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

int n, ans, temp;

int main() {
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  rep (i, n) {
    cin >> temp;
    a[i] = temp;
    b[i] = temp;
  }
  sort(b.rbegin(), b.rend());
  rep (i, n) {
    cout << (a[i] == b[0] ? b[1] : b[0]) << endl;
  }
  return 0;
}


Measured memory_bytes: 3200
#include<iostream>
#include<string>
using namespace std;
int main()
{
 int i,cnt;
 string s;
 while(getline(cin,s),s!="END OF INPUT"){
  cnt=0;
  for(i=0;i<s.size();i++){
   if(s[i]!=' '){
    cnt++;
   }else{
    cout<<cnt;
    cnt=0;
   }
  }
  if(s[i-1]!=' ')cout<<cnt;
  cout<<endl;
 }
}

Measured memory_bytes: 0
from collections import defaultdict
N,W = map(int, input().split())
wv = [list(map(int,input().split())) for _ in range(N)]

dp = defaultdict(int)
dp[0] = 0
for w, v in wv:
    dp_cur = list(dp.items())
    for w_cur, v_cur in dp_cur:
        if w_cur+w <= W:
            dp[w_cur+w] = max(dp[w_cur+w],v_cur+v)

print(max(dp.values()))


Measured memory_bytes: 4052
#include <iostream>
#include <string>

int main(void){
    int N, A, B, ans=0;
    std::cin >> N >> A >> B;

    for (int i=1; i<=N; ++i){
        std::string S = std::to_string(i);
        int a = 0;
        for (char s: S){
            a += (int)(s - '0');
        }
        if (A <= a && a <= B){
            ans += i;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3712
#include <bits/stdc++.h>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#define rep(i, n) repr((i), 0, (n))
#define repr(i, a, t) reps((i), (a), (t), 1)
#define reps(i, a, t, s) for (long long (i) = (a); (i) < (long long)(t); (i) += (s))
#define rrep(i, n) rrepr((i), (n) - 1, 0)
#define rrepr(i, a, t) rreps((i), (a), (t), 1)
#define rreps(i, a, t, s) for (long long (i) = (a); (i) >= (long long)(t); (i) -= (s))
#define each(v, c) for (auto &&(v) : (c))
using namespace std;
namespace mp = boost::multiprecision;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ml = mp::cpp_int;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

/**
 * https://ja.wikipedia.org/wiki/クヌース–モリス–プラット法
 * 文字列検索
 */
class KMP {
 private:
  string needle;
  vector<ll> kmp;

 public:
  explicit KMP(const string &needle) : needle(needle), kmp(needle.size() + 2, 0) {
    // 部分マッチテーブルを構築
    kmp[0] = -1;
    kmp[1] = 0;
    {
      ll i = 2;
      ll j = 0;
      while (i < needle.size()) {
        if (needle[i - 1] == needle[j]) {
          kmp[i++] = ++j;
        } else if (j > 0) {
          j = kmp[j];
        } else {
          kmp[i++] = 0;
        }
      }
    }
  }

  /**
   * @param haystack
   * @param m The position of the current character in haystack
   * @param i The position of the current character in needle
   * @return
   */
  ll index(const string &haystack, ll m = 0, ll i = 0) {
    while (m + i < haystack.size()) {
      if (needle.at(i) == haystack.at(m + i)) {
        i++;
        if (i == needle.size()) {
          return m;
        }
      } else {
        m += i - kmp.at(i);
        if (i > 0) {
          i = kmp.at(i);
        }
      }
    }
    return -1;
  }

  /**
   * haystack から needle を検索する
   * @param haystack
   * @return
   */
  vector<ll> search(const string &haystack) {
    vector<ll> ret(haystack.size(), false);

    ll m = 0;
    ll i = 0;
    while (m + i < haystack.size()) {
      m = index(haystack, m, i);
      if (m < 0) break;
      ret.at(m) = true;
      m += needle.size() - kmp.at(needle.size() - 1) - 1;
      i = max(0ll, kmp.at(needle.size() - 1));
    }
    return ret;
  }
};

ll solve() {

  string s, t;
  cin >> s >> t;

  ll ls, lt;
  ls = s.size();
  lt = t.size();

  do {
    s += s;
  } while (s.size() < t.size() * 3);

  ll ret = 0;
  KMP kmp = KMP(t);
  vector<ll> matches = kmp.search(s);
  vector<bool> seen(ls, false);

  ll i = -1;
  while (++i < ls) {
    while (i < matches.size() && !matches[i]) i++;
    if (i > ls) break;
    if (seen[i]) continue;

    ll j = 0;
    while (matches[i + j * lt]) {
      if (i + j * lt < ls) seen[i + j * lt] = true;
      if (j * lt >= ls) return -1;
      j += 1;
    }
    ret = max(ret, j);
  }
  return ret;
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ifstream ifs;
  if (getenv("LOCAL") != nullptr) {
    ifs.open("src/_in.txt");
    cin.rdbuf(ifs.rdbuf());
  }

  cout << solve() << endl;

}

Measured memory_bytes: 25232
Scanf.scanf "%d %d" (fun n m ->
    let ab = Array.init m (fun _ -> Scanf.scanf " %d %d" (fun a b -> b, a)) in
    Array.sort compare ab;

    let rec loop i l acc =
        if i = m then acc else
            let (b, a) = ab.(i) in
            if a <= l then loop (i + 1) l acc else
                loop (i + 1) (b - 1) (acc + 1)
    in
    loop 0 0 0 |> Printf.printf "%d\n"
)

Measured memory_bytes: 9376
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#define debug(x) cerr << #x << ':' << x << endl
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
using namespace std;
typedef long long ll;

const int mod = 1e9+7;

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

    map<int,ll> factor;
    for(int k=2; k<=n; k++){
        int tmp = k;
        for(int i=2; i<=tmp; i++){
            while(tmp%i==0){
                factor[i]++;
                tmp/=i;
            }
        }
    }
    // for(auto f : factor){
    //     cout << f.first << ":" << f.second << endl;
    // }

    ll ans=1;
    for(auto f : factor){
        ans=(ans*(f.second+1))%mod;
    }
    
    cout << ans << endl;
    return 0;
}

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

#define REP(i,n) for(int i = 0;i < n;i++)
#define REPR(i,n) for(int i = n-1;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()
#define ll long long
#define GREATER greater<int>()

using namespace std;

string pop_back(string s){
    string t = s.substr(0,s.size()-1);
    return t;
}

int gcd(int max,int min){
    
    if(max<min){
        int tmp=max;
        max=min;
        min=tmp;
    }

    if(max%min==0)return min;
    else return gcd(min,max%min);

}

int main(void){

    int h,w;
    cin>>h>>w;
    char a[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a[i][j];
        }
    }
    for(int i=0;i<h;i++){
        bool lflag=false;
       for(int j=0;j<w;j++){
            bool flag1=false,flag2=false;
            if(a[i][j]=='#'){
                flag1=true;
                flag2=true;
            }
            else{
                for(int k=0;k<h;k++){
                    if(a[k][j]=='#')flag1=true;
                }
                for(int l=0;l<w;l++){
                    if(a[i][l]=='#')flag2=true;
                }
            }
            if(flag1&flag2){
                cout<<a[i][j];
                lflag=true;
            }
        }
        if(lflag)
            cout<<endl; 
    }

    return 0;
}




Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;

int l;

/*bool comp(string str1, string str2){
	for(int i = 0; i < l; ++i){
		if(str1[i] - 'a' > str2[i] - 'a'){
			return 1;
		}else if(str1[i] - 'a' < str2[i] - 'a'){
			return 0;
		}
	}

	return 1;
}*/

int main(){
	int n, l;
	cin >> n >> l;
	
	vector <string> v;
	for(int i = 0; i < n; ++i){
		char str[l + 1];
		scanf("%s", str);
		string s(str);
		v.push_back(s);
	}
		

	sort(v.begin(), v.end());
	
	for(int i = 0; i < n; ++i)
		cout << v[i];
	printf("\n");

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
using namespace std;

using ll = long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1e9;
const long long INFL = 1LL<<60;

ll calc_num_of_combination(ll n, ll r) {
  ll num = 1;
  for(ll i = 1; i <= r; i++){
    num = num * (n - i + 1) / i;
  }
  return num;
}

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

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

  ll ans = 0;
  for (auto& p : mp) {
    if (p.second <= 1) continue;
    ans += calc_num_of_combination(p.second, 2);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 233;
long long sum = 0,k; 
int ch[maxn],n,cnt=0;
void add(int x,int v){
	for(int i=x;i<=n;i+=i&(-i))
		ch[i] += v;
}
int query(int x){
	int sum = 0;
	for(int i=x;i;i-=i&(-i))
		sum += ch[i];
	return sum; 
}
void add(int x){
	sum += query(x);
	add(x,1);
}
void remove(int x){
	add(x,-1);
	sum -= query(n)-query(x);
}
int find(int k){
	int x = 0; 
	for(int i=20;i>=0;i--)
		if((x+(1<<i))<=n&&ch[x+(1<<i)]<k){
			x += 1<<i;
			k -= ch[x];
		}
	return x+1;
}
int a[maxn];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		a[i]++;
	}
	for(int i=2;i<=k;i++)add(a[i]);
	int ans = 1,first = 0;
	if(sum+query(n)-query(a[1])==k*(k-1)/2)first = 1;
	for(int i=1;i<n-k+1;i++){
		int l = find(1),r = find(k-1);
//		cout<<"->"<<i<<" "<<l<<" "<<r<<endl; 
		
		if(a[i]<=l&&r<=a[i+k])
		{
			
		}
		else{
			if(sum+query(a[i+k])==k*(k-1)/2){
//				cout<<"!!!!!!!!!!!!!!"<<i+1<<endl;
				if(!first){
					first = 1 ;
					ans++;
				}
			}
			else{
				ans++;
			}
		}
		remove(a[i+1]);
		add(a[i+k]);
//		cout<<"Remove "<<" " << a[i+1] << endl;
//		cout << "Add " << " " << a[i+k] << endl;
//		cout<<"!"<<ans<<endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a,b,c;
  cin >> n;
  if(n==2) {
      cin >> a >> b;
      for(int i=1; i<=min(a,b); i++) {
          if(a%i==0&&b%i==0) {
              cout << i << endl;
          }
      }
  }
  else {
      cin >> a >> b >> c;
      for(int i=1; i<=min({a,b,c}); i++) {
          if(a%i==0&&b%i==0&&c%i==0) {
              cout << i << endl;
          }
      }
  }
  return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;

#define MP make_pair
#define PB push_back
#define FF first
#define SS second

#define FORN(i, n) for (int i = 0; i <  (int)(n); i++)
#define FOR1(i, n) for (int i = 1; i <= (int)(n); i++)
#define FORD(i, n) for (int i = (int)(n) - 1; i >= 0; i--)

#define DEBUG(X) { cout << #X << " = " << (X) << endl; }
#define PR0(A,n) { cout << #A << " = "; FORN(_,n) cout << A[_] << ' '; cout << endl; }

#define MOD 1000000007
#define INF 2000000000

int GLL(LL& x) {
    return scanf("%lld", &x);
}

int GI(int& x) {
    return scanf("%d", &x);
}

LL q, s, h, d, n;

int main() {
    cin >> q >> s >> h >> d >> n;

    n *= 4;

    s = min(s, q + q);
    h = min(h, s + s);
    d = min(d, h + h);

    LL res = 0;

    res += (n / 8) * d; n %= 8;
    res += (n / 4) * h; n %= 4;
    res += (n / 2) * s; n %= 2;
    res += (n); n %= 1;

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
H,W=map(int,input().strip().split())
s=[]
for _ in range(H):
    s.append(list(input()))

def judge(i,j,s,H,W):
    find=False
    dh=[0,1,0,-1]
    dw=[1,0,-1,0]
    for n in range(4):
        if 0<=i+dh[n]<=H-1 and 0<=j+dw[n]<=W-1:
            if s[i+dh[n]][j+dw[n]]=="#":
                find=True
                break
    return find

def main():
    end=False
    for i in range(H):
        if end==True:
            break
        for j in range(W):
            if s[i][j]=="#":
                if not judge(i,j,s,H,W):
                    print("No")
                    end=True
                    break
    if end==False:
        print("Yes")
if __name__=="__main__":
	main()

Measured memory_bytes: 9240
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

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

    int ans = 0;
    rep(i, n) {
        int h;
        cin >> h;

        if(h >= k) {
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
import fractions
import collections
A,B = map(int,input().split())
p = fractions.gcd(A,B)
#print(p)
num = []
for i in range(2,int(p**0.5)+1):
    while p%i==0:
        num.append(i)
        p //= i
if p != 1:
    num.append(p)
#print(num)
pp = collections.Counter(num)
print(len(pp)+1)

Measured memory_bytes: 65640
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    double A,B;
    while(cin>>A>>B){
        if(A<35.5&&B<71.0)puts("AAA");
        else if(A<37.5&&B<77.0)puts("AA");
        else if(A<40.0&&B<83.0)puts("A");
        else if(A<43.0&&B<89.0)puts("B");
        else if(A<50.0&&B<105.0)puts("C");
        else if(A<55.0&&B<116.0)puts("D");
        else if(A<70.0&&B<148.0)puts("E");
        else puts("NA");
    }
    return 0;
}

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

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

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

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

//素因数分解
vector<pair<ll,ll> > prime_factorize(ll n){
  vector<pair<ll,ll> > res;
  for(ll p=2; p*p<=n; p++){
    if(n%p!=0)continue;
    int num=0;
    while(n%p==0){
      num++;
      n/=p;
    }
    res.push_back(make_pair(p,num));//pでnum回割り切れる
  }
  if(n!=1)res.push_back(make_pair(n,1));
  return res;
}

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

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


int main(){
  int n,m,tmp,cnt=0;
  ll ans=1;
  cin >> n >> m;
  auto v = prime_factorize(m);
  COMinit();  
  for(auto pa:v){
    int num = pa.second;
    ll tmp = COM(num+n-1,n-1);
    ans = (ans*tmp)%MOD;
  }
  cout << ans << endl;
}

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

using namespace std;

int main() {
	int N,M,R; cin >> N >> M >> R;
	vector<int> r(R);
	for(auto&a:r) cin >> a,--a;
	vector<vector<int> > G(N,vector<int>(N,1e9));
	for(int i=0;i<M;++i) {
		int A,B,C; cin >> A >> B >> C;
		--A, --B;
		G[A][B]=C;
		G[B][A]=C;
	}
	for(int k=0;k<N;++k)
		for(int i=0;i<N;++i)
			for(int j=0;j<N;++j)
				G[i][j]=min(G[i][j],G[i][k]+G[k][j]);
	sort(r.begin(),r.end());
	int ans=1e9;
	do {
		int tmp=0;
		for(int i=1;i<R;++i) {
			tmp+=G[r[i-1]][r[i]];
		}
		ans=min(ans,tmp);
	} while(next_permutation(r.begin(),r.end()));
	cout << ans << endl;
	
	return 0;
}


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

    using namespace std;
    #define ll  long long
    #define ld  long double
    #define endl '\n'
    #define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    const ll MOD = 1e9 + 7;
    const double PI = 3.141592653589793238463;
    const int MAXN = 20000005;
    bool isPrime[MAXN];
    vector<int> pr;
    vector<pair<int,int>> ans;
    void sieve()
    {
        memset(isPrime, 1, sizeof isPrime);
        isPrime[0] = isPrime[1] = 0;

        for (int i = 2; i * i <= MAXN; i += 1 + (i & 1))
        {
            if (isPrime[i])
            {

                for (int j = i * i; j < MAXN; j += i)
                    isPrime[j] = 0;
            }
        }
        for(int i=0; i<MAXN; i++)
        {
            if(isPrime[i])
            {
                if(!pr.empty())
                {
                    if(i-pr.back()==2)
                    {
                        ans.push_back({pr.back(),i});
                    }
                }
                pr.push_back(i);

            }
        }
    }

    ld power(ld x, ll y)
    {
        ll temp;
        if (y == 0)
            return 1;
        temp = power(x, y / 2);
        if (y % 2 == 0)
            return temp * temp;
        else
            return x * temp * temp;
    }

    void debug_out()
    {
        cerr << endl;
    }

    template<typename Head, typename... Tail>
    void debug_out(Head H, Tail... T)
    {
        cerr << " " << H;
        debug_out(T...);
    }

    #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
    int main()
    {
    int n;
    cin>>n;
    int arr[n];
    int temp=0;
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        temp^=arr[i];
    }
    for(int i=0;i<n;i++)
    {
       cout<<(temp^arr[i])<<" ";
    }


        return 0;
    }


Measured memory_bytes: 4328
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <set>
#include <map>
#include <queue>
#include <stack>

using namespace std;

#define INF 1010001000
#define EPS 1e-10
#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef pair<int, int> i_i;
typedef long long int llong;
typedef pair<llong, llong> ll_ll;
typedef struct edge {int f, t;}Edge;

int main()
{
    int n;
    while (cin >> n, n) {
        vector<int> vote(26, 0);
        bool fl = false;
        rep(i, n) {
            string s;
            cin >> s;
            vote[s[0]-'A']++;

            if (!fl) {
                int fir = -1, sec = -1;
                rep(j, 26) {
                    if (vote[fir] < vote[j]) {
                        sec = fir;
                        fir = j;
                    } else if (vote[sec] < vote[j]) {
                        sec = j;
                    }
                }
                if (vote[fir] - vote[sec] > n - i - 1) {
                    putchar(fir + 'A');
                    cout << " " << i+1 << endl;
                    fl = true;
                }
            }
        }
        if (!fl) {
            cout << "TIE" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3132
import java.util.*;

class Main
{
	public static void main(String args[]) throws Exception
	{
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		int [] a=new int [n];
		for(int i=0;i<n;i++)
		{
			a[i]=in.nextInt();
		}
		Arrays.sort(a);
		long ans=0;
		if (n % 2 != 0) {
            ans += a[n / 2];
            for (int i = n / 2 + 1; i < n - 1; i++) {
                ans = ans + 2 * a[i];
            }
            ans += a[n - 1];
        } else {
            for (int i = n / 2; i < n - 1; i++) {
                ans = ans + 2 * a[i];
            }
            ans += a[n - 1];
        }
		System.out.println(ans);
	}
}

Measured memory_bytes: 60988
#include <iostream>

int main(){
   int N, A, B;
   std::cin >> N >> A >> B;
   int sum2 = 0;
   for (int i=1; i<=N; i++){
      int N5 = i/10000;
      int N4 = (i-N5*10000)/1000;
      int N3 = (i-N5*10000-N4*1000)/100;
      int N2 = (i-N5*10000-N4*1000-N3*100)/10;
      int N1 = (i-N5*10000-N4*1000-N3*100)%10;
      int sum = N1+N2+N3+N4+N5;
      //std::cerr << sum << std::endl;
      if ((sum >= A) && (sum <= B)){
         sum2 = sum2 + i;
         //std::cerr << i << " " << sum2 << std::endl;
      }
   }
   std::cout << sum2 << std::endl;
}



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

int main()
{
    int a, b;
    cin >> a >> b;
    double ret = 0.0;
    for (int i = 1; i <= a;i++)
    {
        double tmp = 1.0 / a;
        int now = i;
        while(now < b)
        {
            now *= 2.0;
            tmp /= 2.0;
        }
        ret += tmp;
    }
    cout << fixed << setprecision(12) << ret << endl;
    return 0;
}

Measured memory_bytes: 256
MOD = 10**9 + 7

def modpow(a,n):
    r=1
    while n > 0:
        if n%2==1:
            r = r*a%MOD
        a = a*a % MOD
        n = n//2
    return r

N,K = map(int,input().split())
As = list(map(int,input().split()))



As.sort(key=lambda x:abs(x),reverse=True)
As_srt=sorted(As)

if N==K or (As_srt[-1]<0 and K%2==1):
    ans=1
    for i in range(K):
        ans *= As[N-i-1]
        ans %= MOD
    print(ans)
else:
    ans = 1
    sign = 1
    for i in range(K):
        ans *=As[i]
        ans %=MOD
        if As[i]<0:
            sign *= -1
    if sign < 0:
        #print(As,ans) ###
        # ansを正にする
        rm_p=None
        rm_n=None
        for i in range(K):
            if rm_p!=None and rm_n!=None:
                break
            if rm_p==None and As[K-i-1]>0:
                rm_p=As[K-i-1]
            if rm_n==None and As[K-i-1]<0:
                rm_n=As[K-i-1]
        
        apd_zp=None
        apd_n=None
        for i in range(N-K):
            if apd_zp!=None and apd_n!=None:
                break
            if apd_zp==None and As[K+i]>=0:
                apd_zp=As[K+i]
            if apd_n==None and As[K+i]<0:
                apd_n=As[K+i]
        #print(rm_n,rm_p,apd_n,apd_zp) ###

        if rm_n == None or apd_zp == None:
            rm=rm_p
            apd=apd_n
        elif rm_p == None or apd_n == None:
            rm=rm_n
            apd=apd_zp
        else:
            if abs(rm_p * apd_zp) <= abs(rm_n * apd_n):
               rm=rm_p
               apd=apd_n
            else:
                rm=rm_n
                apd=apd_zp
        ans *= apd
        ans %=MOD
        rm_inv = modpow(rm,MOD-2)
        ans *= rm_inv
        ans %= MOD

    print(ans)

Measured memory_bytes: 32088
fun main(args: Array<String>) {
    abc109a()
}

fun abc109a() {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }

    val answer = if (a % 2 == 0 || b % 2 == 0) "No" else "Yes"

    println(answer)
}


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

int main(){
  int n,s[100],ans=0;

  cin >> n;
  for(int i = 0; i < n; i++) cin >> s[i];

  sort(s,s+n);

  for(int i = 0; i < n; i++){
    ans += s[i];
  }
  if(ans % 10 == 0){
    for(int i = 0; i < n; i++){
      if(s[i] % 10 != 0){
        ans -= s[i];
        cout << ans << endl;
        return 0;
      }
    }

    cout << 0 << endl;
    return 0;
  }

  else cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//cout<<setprecision(1)<<fixed<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int MAX_N=100000;
const int INF = 0x3f3f3f3f;
#define eps 1e-7
//#define Kongxiangzhouye
//int n,m;
//int e;
//int begin[301010];
//int next[301010];
//int to[301010];

int par[101010];

int find(int x){
    if(x!=par[x])
        par[x] = find(par[x]);
    return par[x]; 
}

int unite(int x,int y){
	x=find(x);
	y=find(y);
	if(x!=y)
		par[y]=x;
}

void init(int n){
	for(int i=0;i<=n;i++){
		par[i]=i;
	}
}
int main(){
	ios::sync_with_stdio(false);
	#ifdef Kongxiangzhouye
		freopen("in.txt","r",stdin);
		freopen("out.txt","w",stdout);
	#endif
	int n,m,q;
	while(cin>>n>>m){
		init(n);
		for(int i=0;i<m;i++){
			int a,b;
			cin>>a>>b;
			unite(a,b);
		}
		cin>>q;
		for(int i=0;i<q;i++){
			int a,b;
			cin>>a>>b;
			if(find(a)==find(b))
				cout<<"yes"<<endl;
			else
				cout<<"no"<<endl;
		}
	}

	return 0;
}






Measured memory_bytes: 3544
s = input()
if(s[0]=="R"):
    if(s[1]=="R"):
        if(s[2]=="R"):
            print(3)
        else:
            print(2)
    else:
        print(1)
else:
    if(s[1]=="R"):
        if(s[2]=="R"):
            print(2)
        else:
            print(1)
    else:
        if(s[2]=="R"):
            print(1)
        else:
            print(0)


Measured memory_bytes: 9052