akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define INF 1e8
#define EPS 1e-9

#define rep2(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) rep2(i,0,n)
#define ll long long
#define P pair<int,int>
#define pb push_back

int n,w[10],s[10],used[10],g;
string F[10];
vector<int> ans;

void f(vector<int> order){
	if(order.size()==n){
		int x=0;
		rep(i,n)x+=w[order[i]]*(n-i);
		if(x<g){
			g=x;
			ans=order;
		}
		return;
	}
	int x=0;
	rep(i,order.size())x+=w[order[i]];
	rep(i,n)if(!used[i]&&s[i]>=x){
		order.pb(i);
		used[i]=1;
		f(order);
		used[i]=0;
		order.pop_back();
	}
}

int main(){
	while(cin>>n&&n){
		fill(used,used+n,0);
		g=INF;
		rep(i,n)cin>>F[i]>>w[i]>>s[i];
		vector<int> v;
		f(v);
		rep(i,n)cout<<F[ans[n-1-i]]<<endl;
	}
}

Measured memory_bytes: 0
long_and_wize = []
prev = nil

gets
A = gets.split.map(&:to_i).sort

A.reverse_each do |a|
  if prev && a == prev
    long_and_wize << a
    break if long_and_wize.size == 2

    prev = nil
  else
    prev = a
  end
end

if long_and_wize.size == 2
  puts long_and_wize.inject(&:*)
else
  puts 0
end


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

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

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

	int m = 1;
	int k = 0;
	for (int i = 0; i < n; ++i) {
		if (a[i] == m) {
			++m;
		} else {
			++k;
		}
	}

	if (m == 1 || k == n) {
		cout << -1;
	} else {
		cout << k;
	}
	
	return 0;
}
	

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define int long long
#define double long double
#define mod 1000000007
#define F first
#define S second
#define P pair<long long,long long>
#define all(a) a.begin(),a.end()
#define INF 1000000000000000000
using namespace std;

signed main(){
    int h,w,n; cin>>h>>w>>n;
    vector<int> a(n); rep(i,n)cin>>a.at(i);
    vector<vector<int>> grid(h,vector<int>(w));
    int i=0,j=0;
    rep(l,n){
        rep(k,a.at(l)){
            if(i%2==0){
                if(j==w){
                    grid.at(i+1).at(j-1)=l+1;
                    j-=2;
                    i++;
                }else{
                    grid.at(i).at(j)=l+1;
                    j++;
                }
            }else{
                if(j==-1){
                    grid.at(i+1).at(j+1)=l+1;
                    j+=2;
                    i++;
                }else{
                    grid.at(i).at(j)=l+1;
                    j--;
                }
            }
        }
    }
    rep(i,h){
        rep(j,w-1){
            cout<<grid.at(i).at(j)<<' ';
        }
        cout<<grid.at(i).back()<<endl;
    }
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <ostream>
using namespace std;
template <typename T> void printRange(T &x) { for (auto y : x) cout << y << ' '; cout << endl; }
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define getNum(i) scanf("%d", &(i))
#define MODULO 321555123
#define INF 10000000007ll
#define FOR(i,j,k) for(int (i)=(j);(i)<=(k);(i)++)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define IOS ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define getNum(i) scanf("%d", &(i))
#define mp make_pair
#define reset(a) memset((a), 0, sizeof((a)))

const int maxn = 2e5 + 10;

int main() {
// #ifndef ONLINE_JUDGE
//     freopen("input.in", "r", stdin);
// #endif
    IOS
    int h, w;
    cin >> h >> w;

    int row = (h&1) * w;
    int col = (w&1) * h;
    map<char, int> cnt;
    REP(i, h) {
        REP(j, w) {
            char x;
            cin >> x;
            cnt[x]++;
        }
    }
    int fill = h*w - row - col + (h&w&1);

    for (auto p : cnt) {
        if (fill == 0) break;
        while (p.second >= 4 && fill > 0) {
            p.second -= 4;
            fill -= 4;
        }
        cnt[p.first] = p.second;
    }

    if (fill > 0) {
        cout << "No" << endl;
        return 0;
    }

    int odd = 0;
    for (auto p : cnt) {
        if (p.second % 2) {
            odd++;
            p.second--;
            cnt[p.first] = p.second;
        }
    }

    bool haveOdd = (h&w&1);

    if (odd != haveOdd) {
        cout << "No" << endl;
        return 0;
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
/**
 *    author:  tourist
 *    created: 18.12.2019 11:39:49       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<double> dp(1, 1);
  for (int i = 0; i < n; i++) {
    double p;
    cin >> p;
    vector<double> new_dp(i + 2);
    for (int j = 0; j <= i; j++) {
      new_dp[j] += dp[j] * (1 - p);
      new_dp[j + 1] += dp[j] * p;
    }
    swap(dp, new_dp);
  }
  double ans = 0;
  for (int j = 0; j <= n; j++) {
    if (j > n - j) {
      ans += dp[j];
    }
  }
  cout << fixed << setprecision(17) << ans << '\n';
  return 0;
}


Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BK solver = new BK();
        solver.solve(1, in, out);
        out.close();
    }

    static class BK {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int k = in.nextInt();
            int n = in.nextInt();
            int[] a = new int[n];
            int max = 0;
            for (int i = 0; i < n; i++) {
                a[i] = in.nextInt();
                max = Math.max(max, a[i]);
            }

            out.println(Math.max(0, (max - (k + 1) / 2) * 2 - 1 + k % 2));

        }

    }
}



Measured memory_bytes: 23764
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
	int hoge;
	int r, g, b;
	cin >> r >> g >> b;
	hoge = r * 100 + g * 10 + b;
	if (hoge % 4 == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 764
using System;
using CompLib.Util;

public class Program
{
    private long N, S;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();
        S = sc.NextLong();

        // NをB進表記 桁和がSになるB
        // 1桁
        if (N == S)
        {
            Console.WriteLine(N + 1);
            return;
        }

        // 3桁以上
        long b = 2;
        for (; b * b <= N; b++)
        {
            if (F(b, N) == S)
            {
                Console.WriteLine(b);
                return;
            }
        }

        // 2桁
        // aB + c = N
        // a + c = S
        // a(B-1) = N-S
        long ans = long.MaxValue;
        {
            long T = N - S;
            for (long a = 1; a * a <= T; a++)
            {
                if (T % a == 0)
                {
                    long c = T / a;
                    if(F(a+1,N) == S) ans = Math.Min(ans, a+1);
                    if (F(c + 1, N) == S) ans = Math.Min(ans, c + 1);
                }
            }
        }
        if (ans == long.MaxValue)
        {
            Console.WriteLine("-1");
            return;
        }
        Console.WriteLine(ans);
    }

    long F(long b, long n)
    {
        if (n < b) return n;
        return F(b, n / b) + (n % b);
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 27056
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>

using namespace std;

struct Tag {
    double p, t, v;
};

double dp[51][100][51]; // dp[M][N][k] for k rests
double tim[100][51];

int main() {
    int N, M, L;
    cin >> N >> M >> L;

    vector<Tag> v;
    for(int i = 0; i < N; ++i) {
        Tag t;
        cin >> t.p >> t.t >> t.v;
        t.p /= 100;
        v.push_back(t);
    }

    for(int i = 0; i < N; ++i) {
        dp[0][i][0] = 1;
    }
    for(int m = 1; m <= M; ++m) {
        for(int n = 0; n < N; ++n) {
            for(int k = 0; k <= M; ++k) {
                dp[m][n][k] = v[n].p*dp[m-1][n][k-1] + (1-v[n].p)*dp[m-1][n][k];
                //printf("%d %d %d = %d\n", m, n, k, dp[m][n][k]);
            }
        }
    }
    for(int n = 0; n < N; ++n) {
        tim[n][0] = (double)L / v[n].v;
        for(int k = 1; k <= M; ++k) {
            tim[n][k] = tim[n][k-1] + v[n].t;
        }
    }
    for(int n = 0; n < N; ++n) {
        double prob = 0;
        if(v[n].v == 0) goto END;

        for(int k = 0; k <= M; ++k) {
            double tmp = dp[M][n][k];
            for(int nn = 0; nn < N; ++nn) {
                if(n == nn) continue;
                double *bound = upper_bound(tim[nn], tim[nn]+M+1, tim[n][k]);
                int idx = bound - tim[nn];
                double sum = 0;
                for(int i = idx; i <= M; ++i) sum += dp[M][nn][i];
                tmp *= sum;
            }
            prob += tmp;
        }
END:
        printf("%.6f\n", prob);
    }

    return 0;
}

Measured memory_bytes: 3056
#include<iostream>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

int T,N,t[50],d[110],a,b;
int dp[110][50];

int main(){
  while(cin >> T,T){
    rep(i,T)cin >> t[i];
    cin >> N;
    rep(i,100)d[i] = 24;
    rep(i,N){
      cin >> a >> b; a--;
      d[a] = min(d[a],b);
    }

    rep(i,101)rep(j,T)dp[i][j] = 1000000;
    dp[0][0] = 0;

    rep(i,100){
      rep(j,T){
	if(t[j]<=d[i]){
	  int nxt = (j+1)%T;
	  dp[i+1][nxt] = min(dp[i+1][nxt],dp[i][j]);
	}
	dp[i+1][1] = min(dp[i+1][1],dp[i][j]+1);
      }
    }

    int ans = 1000000;
    rep(i,T)ans = min(ans,dp[100][i]);
    cout << ans << endl;
  }
}

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

int x;

int cubic(int n) {
  return n*n*n;
}
int tetra(int n) {
  return n*(n+1)*(n+2)/6;
}

int solve() {
  int maxi = -1;

  for(int i = 0; ; i++) {
    int c = cubic(i);
    if(c > x) break;
    for(int j = 0; ; j++) {
      int t = tetra(j);
      if(t + c > x) break;
      maxi = max(maxi, t+c);
    }
  }

  return maxi;
}

main() {
  while(( cin >> x ) && x) {
    cout << solve() << endl;
  }
}

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

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

int main(){
  cin.tie(nullptr);ios_base::sync_with_stdio(false);
  int n;cin>>n;
  int c,d,e;
  vector<int>a(n),b(n);
  rep(i,n){
    cin>>a[i];
  }
  b=a;
  sort(b.begin(),b.end(),greater<int>());
  c=b[0],d=b[1];
  rep(i,n){
    //cout<<a[i]<<endl;
    if(a[i]==c){
      e=i;
      break;
    }
  }
  rep(i,n){
    cout<<(i!=e?c:d)<<endl;
  }
}


Measured memory_bytes: 3200
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");
        int n = Integer.valueOf(arr01[0]);

        int mysum = 0;
        int temp = 0;
        for (int i = 1; i < 1 + n; i++) {
            String arr_temp[] = mylist.get(i).split(" ");

            String s = arr_temp[0];
            int t = Integer.valueOf(arr_temp[1]);
            mysum += t;
            //            System.out.println(s + " " + t + " " + mysum + " " + mylist.get(n + 1));
            if (s.equals(mylist.get(n + 1))) {
                temp = mysum;
            }

        }

        System.out.println(mysum - temp);
    }

}


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

using namespace std;

#define int 		  long long
#define f(i,n)        for(int i=0;i<(n);++i)
#define fa(i,a,n)     for(int i=a;i<=(n);++i)
#define fd(i,a,n)     for(int i=a;i>=(n);--i)
#define tc 			  int t;cin>>t;f(testcase,t)
#define pii             pair<int,int>

void c_p_c() {

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

}

int32_t main() {

	c_p_c();
	int n;
	cin >> n;
	string s;
	int a[4] = {0};
	f(i, n) {
		cin >> s;
		if (s == "AC")
			a[0]++;
		else if (s == "WA")
			a[1]++;
		else if (s == "TLE")
			a[2]++;
		else if (s == "RE")
			a[3]++;

	}
	cout << "AC x " << a[0] << "\n";
	cout << "WA x " << a[1] << "\n";
	cout << "TLE x " << a[2] << "\n";
	cout << "RE x " << a[3] << "\n";

	return 0;
}



Measured memory_bytes: 3652
from collections import deque

N,M = map(int,input().split())
A = [set() for x in range(N)]
B = [-1]*N

for i in range(M):
    a,b = map(int,input().split())
    a-=1
    b-=1
    A[a].add(b)
    A[b].add(a)

B[0] = 0
D = deque()
D.append(0)
while len(D) != 0:
    d = D.popleft()
    for a in A[d]:
        if B[a] != -1:
            continue
        B[a] = d
        D.append(a)

print("Yes")
for i in range(1,N):
    print(B[i]+1)

Measured memory_bytes: 118408
s=input()
n=len(s)
a=[0]*2019
a[0]=1
k=0
ans=0
mod=1
for i in range(n-1,-1,-1):
  k=(k+int(s[i])*mod)%2019
  mod=(mod*10)%2019
  a[k]+=1
for i in a:
  ans+=i*(i-1)*0.5

print(int(ans))

Measured memory_bytes: 9288
import numpy as np
from itertools import product

N = int(input())
F = np.array([list(map(int, input().split())) for i in range(N)])
P = np.array([list(map(int, input().split())) for i in range(N)])
O = list(product([0, 1], repeat=10))
del O[0]
O = np.array(O)
ans = -float('inf')
for o in O:
    tmp = 0
    OF = F*o
    K = []
    for of in OF:
        K.append(np.count_nonzero(of, axis=0))
    for i in range(N):
        tmp += P[i][K[i]]
    ans = max(ans, tmp)
print(ans)


Measured memory_bytes: 22052
#include<bits/stdc++.h>
using namespace std;
int A[82][82][2],n;
bool P[82][82][80*330];
const int MOD = 1e9+7;
int main(){
	int dif = 80*164;
  int W,H;	cin >> H >> W;
  for (int i = 1; i <= H; i++)
  for (int j = 1; j <= W; j++){
  	cin >> A[i][j][0];  	
  }
  for (int i = 1; i <= H; i++)
  for (int j = 1; j <= W; j++){
  	cin >> A[i][j][1];  	
  }
  P[1][1][abs(A[1][1][0] - A[1][1][1])+dif] = 1;
  P[1][1][-abs(A[1][1][0] - A[1][1][1]) + dif] = 1;
  for (int i = 1; i <= H; i++)
  for (int j = 1; j <= W; j++)
  for (int k = -dif; k <= dif ;k ++){
  		int x = abs(A[i][j][0] - A[i][j][1]);
  		if (k - x + dif >= 0 )
		  P[i][j][k+dif] |= P[i-1][j][k - x+dif],
		  P[i][j][k+dif] |= P[i][j-1][k - x+dif];
		if (k + x + dif < 80*330)
		P[i][j][k+dif] |= P[i-1][j][k+x+dif];
		P[i][j][k+dif] |= P[i][j-1][k+x+dif];	
	  }
	int ans = INT_MAX;		
	for (int i = 0; i < 80*330; i++){
		if (P[H][W][i])
			ans = min(ans,abs(i-dif));
	}
	cout << ans; 
  return 0;
}

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

int main() {
 string s;
 cin >> s;
  
 if(s == "SUN") cout << 7 << endl; 
 if(s == "MON") cout << 6 << endl; 
 if(s == "TUE") cout << 5 << endl; 
 if(s == "WED") cout << 4 << endl; 
 if(s == "THU") cout << 3 << endl; 
 if(s == "FRI") cout << 2 << endl; 
 if(s == "SAT") cout << 1 << endl; 
   
   
 
 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double lf;
typedef pair<ll,ll> ii;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define RST(i,n) memset(i,n,sizeof i)
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(),a.end()
#define X first
#define Y second
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define pob pop_back
#ifdef cold66
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<", ";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0);
#endif // cold66
//}
template<class T> inline bool chkmax(T &a, const T &b) { return b > a ? a = b, true : false; }
template<class T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, true : false; }
template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T, vector<T>, greater<T>>;

const ll MAXn=1e5+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=0x3f3f3f3f;

int main(){
    IOS();
    ll a,p;
    cin >> a >> p;
    cout << (3 * a + p) / 2 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <stdlib.h>
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main() {
	int A, B, M;
	int ans;
	int a[100001], b[100001], c[100001], d[100001];
	int x, y, m;
	scanf("%d %d %d", &A, &B, &M);

	for (int e = 0; e < A;e++){
		scanf("%d", &a[e]);
		c[e] = a[e];
	}
		 qsort(a, A, sizeof(int), compare_int);
    
	for (int e = 0; e < B;e++){
		scanf("%d", &b[e]);
		d[e] = b[e];
	}
        qsort(b, B, sizeof(int), compare_int);
	
	ans = a[0] + b[0];

	for (int f = 0; f < M;f++){
		scanf("%d %d %d", &x,&y,&m);
		if(c[x-1]+d[y-1]-m<ans){
			ans = c[x - 1] + d[y - 1] - m;
		}
	}
	printf("%d",ans);
	return 0;
}

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

using namespace std;

#define ZFor(i,n) for(int i=0;i<n;i++)
#define WFor(i,n) for(int i=1;i<=n;i++)
#define ZWFor(i,n) for(int i=0;i<=n;i++)
#define WZFor(i,n) for(int i=1;i<n;i++)
#define Max -2100000000
#define Min 2100000000
#define F first
#define S second
#define F1 first.first
#define F2 first.second
#define F3 second

typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;


int main(void){
	
	int a[5],ans;
	
	ZFor(i,5)scanf("%d",&a[i]);
	
	if(a[0]<0){
		a[0]*=-1;
		ans=a[0]*a[2];	
		ans+=a[1]*a[4];
		ans+=a[3];
	}else{
		a[1]-=a[0];
		ans+=a[1]*a[4];
	}
	
	printf("%d\n",ans);
	
	return 0;
}

Measured memory_bytes: 3216
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KyoPro
{
    class Program
    {
        static void Main(string[] args)
        {
            string S = Console.ReadLine();

            string first = S.Substring(0, 2);
            string last = S.Substring(2, 2);

            if (IsYearString(first))
            {
                if (IsYearString(last))
                {
                    Console.WriteLine("NA");
                }
                else
                {
                    Console.WriteLine("YYMM");
                }
            }
            else if (IsYearString(last))
            {
                Console.WriteLine("MMYY");
            }
            else
            {
                Console.WriteLine("AMBIGUOUS");
            }
        }

        static bool IsYearString(string s)
        {
            int n = Convert.ToInt32(s);

            if (0 < n && n < 13)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
    }
}


Measured memory_bytes: 27556
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	string words[4] = {"dream", "dreamer", "erase", "eraser"};
	string S;
	cin >> S;

	reverse(S.begin(), S.end());
	for (int i=0;i<4;i++){
		reverse(words[i].begin(), words[i].end());
	}

	int pointer = 0;
	int flag = 0;
	int ans_flag = 0;
	while(S.size()> pointer){

		for(int i=0;i<4;i++){
			string w = S.substr(pointer, words[i].size());
			if (w == words[i]){
				pointer += w.size();
				flag = 1;
				break;
			}
		}
		if(flag == 0){
			ans_flag = 1;
			break;
		}
		flag = 0;
	}
	if(ans_flag==1){
		cout << "NO" << endl;
	}else{
		cout << "YES" << endl;
	}
	return 0;
}

Measured memory_bytes: 512
n, d = map(int, input().split())
x = [0] * n
y = [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())
cnt = 0
for i in range(n):
    if x[i] * x[i] + y[i] * y[i] <= d * d:
        cnt += 1
print(cnt)


Measured memory_bytes: 73204
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  string s;
  cin>>s;
  int n=s.size();
  
  long long cnt[26]={};
  int index;
  REP(i,n){
    index = s[i] - 'a';
    cnt[index]++;
  }
  
  long long ans;
  ans = (long long)n*((long long)n-1)/2;
  REP(i,26){
    ans -= cnt[i]*(cnt[i]-1)/2;
  }
  
  //答えはs自身も含む
  ans++;
  
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 640
n = list(map(int, input().split()))
s = [int(input()) for i in range(n[1])]
s.append(n[0]+1)
memo = [0] * 100001
def stairs(x):
    memo[0] = 1
    memo[1] = 1
    for i in range(2, x+1):
        memo[i] = memo[i-2] + memo[i-1]

salst = [s[0]-1]
for i in range(n[1]):
    sa = (s[i+1]-1) - (s[i]+1)
    salst.append(sa)
    if sa < 0:
        break
if salst[-1] < 0:
    print(0)
else:
    ans = 1
    maxnum = max(salst)
    stairs(maxnum)
    for l in salst:
        ans *= memo[l]
    print(ans%1000000007)


Measured memory_bytes: 460020
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static int mod =1000000007;
	public static void main(String[] args) {
		
		int N=Integer.parseInt(sc.next());
		int K=Integer.parseInt(sc.next());
		int Q=Integer.parseInt(sc.next());
		
		
		if(K-Q>0) {
			for(int i=0;i<Q;i++) {
				sc.next();
			}
			for(int i=0;i<N;i++) {
				p("Yes");
			}
		}else {
			int t=K-Q;
			int v[]=new int[N];
			
			for(int i=0;i<Q;i++) {
				v[Integer.parseInt(sc.next())-1]++;
			}
			for(int i=0;i<N;i++) {
				if(v[i]+t>0)p("Yes");
				else p("No");
			}
			
		}
		
		 
		
	}

	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 50984
n,m=map(int,input().strip().split(' '))

if n % 2 == 1:
    for i in range(1,m+1):
        print(i,n-i)
else:
    used=set()
    prev = n+1
    for i in range(1,m+1):
        prev-=1
        if abs(i-prev)*2==n:
            prev-=1
        while abs(i-prev) in used:
            prev-=1
        print(i,prev)
        used.add(abs(i-prev))
        used.add(n-abs(i-prev))


Measured memory_bytes: 83096
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
int main()
{
	string a;
	cin>>a;
	int k=0;
	for (int i=0;i<a.size();i++)
	{
		if (a[i]=='F'&&k==1)
		k=2;
		else if (a[i]=='C')
		k=1;
	}
	if (k==2)
	cout<<"Yes"<<endl;
	else
	cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N;cin >> N;
	vector<ll>A(N);
	int ans = 1;
	int odd = 1;
	rep(i, N) {
		cin >> A[i];
		ans *= 3;
		if (A[i] % 2 == 0)odd *= 2;
	}
	cout << ans - odd << "\n";

	return 0;
}

Measured memory_bytes: 256
#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#define in std::cin
#define out std::cout

int64_t N;
int64_t A[100000];
int64_t imos_[100010];
auto imos = imos_ + 5;

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N;
	for (int32_t i = 0; i < N; ++i)
	{
		in >> A[i];
	}
	std::sort(A, A + N);
	imos[0] = A[0];
	for (int32_t i = 1; i < N; ++i)
	{
		imos[i] = imos[i - 1] + A[i];
	}

	int32_t total = 0;
	for (int i = N - 1; i >= 0; --i)
	{
		++total;
		if (imos[i - 1] * 2 < A[i]) {
			break;
		}
	}

	out << total << endl;

	return 0;
}
#endif


Measured memory_bytes: 1920
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#define f first
#define s second
#define fore(i,a,b) for(lli i = (a), ThxMK = (b); i < ThxMK; ++i)
#define pb push_back
#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define sz(s) int(s.size())
#define ENDL '\n'
using namespace std;
typedef long double ld;
typedef long long lli;
typedef pair<lli,lli> ii;
typedef vector<lli> vi;
#define deb(x) cout << #x": " << (x) << endl;

int main(){ _
    lli a,b,c,d;
    cin >> a >> b >> c >> d;
    lli pu,pd,pt,pc;
    pu=a*c;
    pd=a*d;
    pt=b*c;
    pc=b*d;
    if(pd>pu)pu=pd;
    if(pt>pu)pu=pt;
    if(pc>pu)pu=pc;
    cout << pu <<ENDL;
    return 0;
}


Measured memory_bytes: 3644
import collections
n = int(input())
v=[]
v=list(map(int,input().split(' ')))

odv = []
evv = []

for i in range(n):
    if i%2 == 1:
        odv.append(v[i])
    else:
        evv.append(v[i])

odvc=collections.Counter(odv)
evvc=collections.Counter(evv)

odvs=len(odv)
evvs=len(evv)

odv_kind=len(odvc.most_common())
evv_kind=len(evvc.most_common()) 

if evvc.most_common()[0][0] != odvc.most_common()[0][0]:
    print( odvs-odvc.most_common()[0][1] + evvs-evvc.most_common()[0][1] )
else:
    if odv_kind > 1 and evv_kind > 1:
        print( min(odvs-odvc.most_common()[0][1] + evvs-evvc.most_common()[1][1] ,
                   odvs-odvc.most_common()[1][1] + evvs-evvc.most_common()[0][1] ) )
    else:
        if odv_kind > 1:
            print( odvs-odvc.most_common()[0][1] )
        elif evv_kind > 1:
            print( evvs-evvc.most_common()[0][1] )
        else:
            print(min(odvs,evvs))




Measured memory_bytes: 20568
#![allow(non_snake_case)]
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn main() {
    input!{
        x: usize,
        y: usize,
    }

    let mut flag: bool = false;

    for kame in 0..=x {
        if y == 4*kame + 2*(x-kame) {
            flag = true;
            break;
        }
    }
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
    
}


Measured memory_bytes: 2160
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 50;
int x[N + 5], y[N + 5];

void hora(int tc) {
	int n;
	cin>>n;
	for(int i = 0;i < n;i++) cin>>x[i]>>y[i];
	int res = 0;
	for(int i = 0;i < n;i++) {
		for(int j = 0;j < n;j++) {
			if(i == j) continue;
			int px = x[i] - x[j];
			int py = y[i] - y[j];
			int tot = 0;
			for(int k = 0;k < n;k++) {
				for(int l = 0;l < n;l++) {
					int dx = x[k] - x[l];
					int dy = y[k] - y[l];
					if(dx == px && dy == py) {
						tot++;
					}
				}
			}
			res = max(res, tot);
		}
	}
	cout<<n - res<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)
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; }

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

    ll tmp = -999999999999999999;
    chmax(tmp, a*c);
    chmax(tmp, a*d);
    chmax(tmp, b*c);
    chmax(tmp, b*d);
    cout << tmp << endl;
}

Measured memory_bytes: 3636
//============================================================================
// Name        : hoba.cpp :)
// Author      : (O_O Diab) (Why_not) (el 3AQ)
// Version     :
// Copyright   : please, Don't touch me :(
// Description : problem in C++
// MAIN IDEA   : combinatorics NCR
//============================================================================
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define rw freopen("graphs_as_a_service.txt","r",stdin),freopen("output.txt","w",stdout);
#define pb push_back
#define F first
#define S second
#define pf push_front
#define lp(i,a,b) for (int i=a;i<=(int)b;++i)
#define lp2(i,a,b) for (int i=a;i>=b;--i)
#define f(x) return cout<<x<<"\n",0
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define p(x) cout<<#x<<" = { "<<x<<" } \n"
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define rep(i,a) lp(i,0,a-1)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define EPS 1e-6
// to convert string to number use int a = stoi(string);
// to convert number to string use string s = to_string(int);
#define FAST ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define clr(c,x) memset(c,x,sizeof(c));
using namespace __gnu_pbds;
using namespace std;
const ll INFL = 0x3f3f3f3f3f3f3f3fLL;
const int dx[] = { 0, 1, 0, -1, 1, -1, 1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int N = 3e2 + 3, mod = (int) 1e9 + 7, INF = 0x3f3f3f3f;
vector<bool> vis;
int main() {
#ifdef ONLINE_JUDGE
	FAST
#endif
	int n;
	cin >> n;
	vis.resize(55566, 1);
	vis[1] = 0;
	lp(i,2,55555)
	{
		if (vis[i]) {
			if (i % 5 == 1 && n) {
				cout << i << " ";
				n--;
			}
			for (int j = i + i; j <= 55555; j += i) {
				vis[j] = false;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
D, G = map(int, input().split())
P = [list(map(int, input().split())) for d in range(D)]

ans = 10**9

for bit in range(1 << D):
  t = 0
  count = 0

  for i in range(D):
    if bit & (1 << i):
        t += P[i][0] * (100*(i+1)) + P[i][1]
        count += P[i][0]

  if t >= G:
    if ans > count:
      ans = count
  else:
    for i in reversed(range(D)):
      if bit & (1 << i):
        continue
      for p in range(P[i][0]):
        t += (i+1)*100
        count += 1

        if t >= G:
          if ans > count:
            ans = count

print(ans)

Measured memory_bytes: 3064
#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef complex<double> P;
typedef long long ll;

// àÏ
double dot(P a, P b) {
  return (a.real() * b.real() + a.imag() * b.imag());
}
// OÏ
double cross(P a, P b) {
  return (a.real() * b.imag() - a.imag() * b.real());
}
// a1,a2ðÊé¼üÆb1,b2ðÊé¼üÌð_vZ
P intersection_l(P a1, P a2, P b1, P b2) {
  P a = a2 - a1; P b = b2 - b1;
  return a1 + a * cross(b, b1-a1) / cross(b, a);
}

// ½p`ÌÊÏö®
double calcPolygonArea(vector<P> p){
  double sum=0;
  for(int i = 0; i < p.size(); i++)
    sum+=cross(p[i],p[(i+1)%(p.size())]);
  return sum/2;
}

int main(){

  int n;
  while(cin>>n&&n!=0){
    // es²ÆÉÀWði[
    vector<P> points[50];
    vector<P> a,b,c,d;
    for(int i = 0; i < n; i++){
      double t;
      cin>>t;
      a.push_back(P(t,0));
    }
    for(int i = 0; i < n; i++){
      double t;
      cin>>t;
      b.push_back(P(t,1));
    }
    for(int i = 0; i < n; i++){
      double t;
      cin>>t;
      c.push_back(P(0,t));
    }
    for(int i = 0; i < n; i++){
      double t;
      cin>>t;
      d.push_back(P(1,t));
    }
    // s²ÆÉi[
    for(int i = 0; i <= n+1; i++){
      if(i==0){
	points[i].push_back(P(0,0));
	for(int j = 0; j < a.size(); j++){
	  points[i].push_back(a[j]);
	}
	points[i].push_back(P(1,0));
      }
      else if(i==n+1){
	points[i].push_back(P(0,1));
	for(int j = 0; j < b.size(); j++){
	  points[i].push_back(b[j]);
	}
	points[i].push_back(P(1,1));
      }
      else{
	points[i].push_back(c[i-1]);
	for(int j = 0; j < a.size(); j++){
	  // ð_ðvZ
	  P crossPoint=intersection_l(c[i-1],d[i-1],a[j],b[j]);
	  points[i].push_back(crossPoint);
	}
	points[i].push_back(d[i-1]);
      }
    }
    double maxRec=-1;
    // elp`ÌÊÏðvZ
    for(int i = 1; i <= n+1; i++){
      for(int j = 1; j <= n+1; j++){
	vector<P> ps;
	ps.push_back(points[i][j-1]);
	ps.push_back(points[i][j]);
	ps.push_back(points[i-1][j]);
	ps.push_back(points[i-1][j-1]);
	maxRec=max(maxRec,abs(calcPolygonArea(ps)));
      }
    }
    printf("%.6f\n",maxRec);
    //cout<<maxRec<<endl;
  }
    
  return 0;
}

Measured memory_bytes: 0
s = input()
n = len(s)
a, b = (n-1)//2, ((n+3)//2)-1
if s[0:a] == ''.join(reversed(s[0:a])) and s[b:] == ''.join(reversed(s[b:])) and s == ''.join(reversed(s)):
	print("Yes")
else:
	print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
const int N = 2e5 + 10;
int x[2][N];
LL sum[2][N];


inline LL getsum(int k, int i, int j) {
	return sum[k][j] - sum[k][i];
}

int main() {
	int L, n;
	scanf("%d%d", &L, &n);
	for (int i = 1; i <= n; i++) scanf("%d", &x[0][i]);
	for (int i = 1; i <= n; i++) x[1][i] = L - x[0][i];
	for (int i = 1; i <= n; i++) {
		sum[0][i] = sum[0][i - 1] + x[0][i] * 2;
		sum[1][i] = sum[1][i - 1] + x[1][i] * 2;
	}
	LL ans = 0;
	/*
	for (int i = 1; i <= n; i++) cout << sum[0][i] << ' ';
	cout << endl;
	for (int i = 1; i <= n; i++) cout << sum[1][i] << ' ';
	cout << endl;
	*/
	for (int k = 0; k <= 1; k++) {
		for (int i = 1; i <= n; i++) {
			int len = min(n - i, i - 1);
			ans = max(ans, max(x[0][i], x[1][i]) + getsum(0, i - len - 1, i - 1) + getsum(1, i, i + len));
			if (k == 0 && n - i > len) {
				ans = max(ans, x[0][i] + getsum(0, i - len - 1, i - 1) + getsum(1, i, i + len + 1));
			}
			if (k == 1 && i - 1 > len) {
				ans = max(ans, x[1][i] + getsum(0, i - len - 2, i - 1) + getsum(1, i, i + len));
			}
			//cout << ans << ' ' << k << ' ' << i << endl;
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 4992
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause") //comment out this on AOJ.
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10; //1e-9?
constexpr ld pi = 3.1415926535897932;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    ll n, ans = LLINF; cin >> n;
    for (ll i = 1; i * i <= n; ++i) {
        if (n % i == 0)chmin(ans, i + (n / i) - 2);
    }
    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <utility>
#define maxn 105
#define EPS 1e-10
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
struct Point{
	double x,y;
	Point(double x = 0.0,double y = 0.0): x(x),y(y) {}
	Point operator + (Point p){
		return Point(x + p.x,y + p.y);
	}
	Point operator - (Point p){
		return Point(x - p.x,y - p.y);
	}
	Point operator * (double lambda){
		return Point(x * lambda,y * lambda);
	}
	Point operator / (double lambda){
		return Point(x / lambda,y / lambda);
	}
	Point operator - (){
		return Point(-x,-y);
	}
	double norm(){
		return x * x + y * y;
	}
	double abs_(){
		return sqrt(norm());
	}
	bool operator == (const Point &p)const
	{
		return abs(x - p.x) < EPS && abs(y - p.y) < EPS;
	}
	bool operator < (const Point &p)const
	{
		if(abs(x - p.x) < EPS) return y < p.y;
		else return x < p.x;
	}
};
typedef Point Vector;
struct Segment{
	Point p1,p2;
	Segment(Point p1 = Point(),Point p2 = Point()): p1(p1),p2(p2) {}
};
typedef Segment Line;
typedef vector<Point> Polygon;
double dot(Vector a,Vector b){ return a.x * b.x + a.y * b.y; }
double det(Vector a,Vector b){ return a.x * b.y - a.y * b.x; }
int ccw(Point p,Segment l){
	if(det(l.p2 - l.p1,p - l.p1) > EPS) return 1;
	if(det(l.p2 - l.p1,p - l.p1) < -EPS) return -1;
	if(dot(l.p2 - l.p1,p - l.p1) < -EPS) return 2;
	if((l.p2 - l.p1).norm() < (p - l.p1).norm()) return -2;
	return 0;
}
bool cross(Segment s1,Segment s2){
	return ccw(s1.p1,s2) * ccw(s1.p2,s2) <= 0 && ccw(s2.p1,s1) * ccw(s2.p2,s1) <= 0;
}
Polygon convexHull(int n,Point* p){
	sort(p + 1,p + n + 1);
	int k = 0;
	Polygon con(n << 1);
	for(int i=1;i<=n;i++){
		while(k > 1 && det(p[i] - con[k - 1],con[k - 2] - con[k - 1]) < EPS) k--;
		con[k++] = p[i];
	}
	int t = k;
	for(int i=n-1;i>=1;i--){
		while(k > t && det(p[i] - con[k - 1],con[k - 2] - con[k - 1]) < EPS) k--;
		con[k++] = p[i];
	}
	con.resize(max(1,k - 1));
	return con;
}
Point bl[maxn],wh[maxn];
int n,m;
bool inside(Point p,Polygon po){
	int k = po.size();
	for(int i=0;i<k;i++){
		int ind = ccw(p,Segment(po[i],po[(i + 1) % k]));
		if(ind != 1 && ind != 0) return false;
	}
	return true;
}
int main(){
	while(~scanf("%d%d",&n,&m) && n){
		for(int i=1;i<=n;i++) scanf("%lf%lf",&bl[i].x,&bl[i].y);
		for(int i=1;i<=m;i++) scanf("%lf%lf",&wh[i].x,&wh[i].y);
		Polygon con1 = convexHull(n,bl);
		Polygon con2 = convexHull(m,wh);
		int k1 = con1.size(), k2 = con2.size();
		bool ok = true;
		ok &= !inside(con1[0],con2);
		ok &= !inside(con2[0],con1);
		if(k1 != 1 && k2 != 1)
			for(int i=0;i<k1;i++){
				for(int j=0;j<k2;j++){
					if(cross(Segment(con1[i],con1[(i + 1) % k1]),Segment(con2[j],con2[(j + 1) % k2]))) ok = false;
				}
			}
		if(ok) puts("YES");
		else puts("NO");
 	}
	return 0;
}



Measured memory_bytes: 3108
import java.util.Scanner;

public class Main {

	private static final int MOD = 1000000007;

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

		int result = Integer.MAX_VALUE / 2;
		for (int i = -100; i <= 100; i++) {
			int sum = 0;
			for (int j = 0; j < a.length; j++) {
				sum += Math.pow(i - a[j], 2);
			}

			result = Math.min(result, sum);
		}

		System.out.println(result);
	}
}


Measured memory_bytes: 9556