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

#define  BeatMeScanf  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define  tc(x)        int x; cin >> x; while(x--)
#define  ll           long long
#define  vi           vector<int>
#define  pii          pair<int,int>
#define  mii          map<int,int>
#define  inf          1<<28
#define  mem(x,y)     memset(x, y, sizeof(x))
#define  ps(x,y)      fixed<<setprecision(y)<<x
#define  show(val)    cout<< #val << " -> " << val << endl
#define  Case         cout<< "Case "<< ++cs << ": "
#define  all(v)       (v).begin(), (v).end()
#define  rall(v)      (v).rbegin(), (v).rend()
#define  MOD          1000000007
#define  MAX          100005

int main()
{
    BeatMeScanf;
    int a, b;
    cin >> a >> b;
    cout << a*b << '\n';
    return 0;
}


Measured memory_bytes: 3624
// https://tenka1-2019-beginner.contest.atcoder.jp/tasks/tenka1_2019_b

#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <regex>
#include <set>
#include <string>
#include <tuple>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

#define EPS (1e-7)
#define INF (1e9)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOREACH(x, a) for (auto &(x) : (a))
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

// long gcd(long a, long b) { return b ? gcd(b, a % b) : a; }
// long lcm(long a, long b) { return a * b / gcd(a, b); }
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    string s;
    cin >> n >> s >> k;
    char rep = s[k - 1];
    for (int i = 0; i < s.length(); i++) {
        if (s[i] != rep) {
            s[i] = '*';
        }
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
import math

n = int(input())
t = 0
x = 0
y = 0
ans = "Yes"

for i in range(n):
    t1 = t
    x1 = x
    y1 = y
    t, x, y = map(int,input().split(' '))

#    print(t, x, y)

    td = abs(t - t1)
    xd = abs(x - x1)
    yd = abs(y - y1)

#    print(td, xd, yd)

    if xd + yd > td:
        ans = "No"
        break
    
    if ( xd + yd ) % 2 != td %2:
        ans = "No"
        break

print(ans)


Measured memory_bytes: 3064
N, M = [int(t) for t in input().split()]
a = [[0]*2 for i in range(M)]
for i in range(M):
    a[i][0], a[i][1] = [int(t) for t in input().split()]

b = sorted(a, key=lambda x: x[1])

count = 1
flag = b[0][1]
for i in range(1, M):
    if b[i][0] < flag:
        continue
    elif b[i][1] > flag:
        flag = b[i][1]
        count += 1

print(count)


Measured memory_bytes: 22056
import java.util.Scanner;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int k,x;
        k=scan.nextInt();
        x=scan.nextInt();
        if(k*500>=x) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 23764
#include<cstdio>
#include<cstring>
#include<set>
#include<vector>
#include<queue>
#include<algorithm>
const int N=500005;
using namespace std;
typedef set<int>::iterator siter;
int n,k,p[N],ans[N],pos[N],du[N],pr[N],pr1[N],cnt;
set<int> fr,bk;
vector<int> a[N];
priority_queue<int> q;
int main()
{
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&p[i]);
		ans[i]=p[i],pos[p[i]]=i;
	}
	for(int i=1;i<=k;i++)
        bk.insert(p[i]);
	for(int i=1;i<=n;i++)
	{
		siter f=bk.upper_bound(p[i]),g=fr.upper_bound(p[i]);
		if(f!=bk.end())
		{
			a[pos[*f]].push_back(i);
			du[i]++;
		}
		if(g!=fr.end())
		{
			a[pos[*g]].push_back(i);
			du[i]++;
		}
		fr.insert(p[i]);
		if(i-k+1>0)
            fr.erase(p[i-k+1]);
		if(i+k<=n)
            bk.insert(p[i+k]);
		bk.erase(p[i]);
	}
	for(int i=1;i<=n;i++)
		if(!du[i])
            q.push(i);
	while(!q.empty())
	{
		int x=q.top();
        q.pop();
		pr[++cnt]=x;
		for(int i=0,sz=a[x].size();i<sz;i++)
		{
			du[a[x][i]]--;
			if(!du[a[x][i]])
                q.push(a[x][i]);
		}
	}
	for(int i=1;i<=n;i++)
        pr1[pr[i]]=n-i+1;
	for(int i=1;i<=n;i++)
        printf("%d\n",pr1[i]);
}


Measured memory_bytes: 66560
import java.util.Scanner;

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

	void solve() {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int q = Integer.parseInt(sc.next());
		char[] c = sc.next().toCharArray();
		int[] cnt = new int[n];
		for(int i=1;i<n;i++) {
			cnt[i]=cnt[i-1];
			if(c[i-1]=='A'&&c[i]=='C') {
				cnt[i]++;
			}
		}
		StringBuilder buf = new StringBuilder();
		String s ="\n";

		for(int i=0;i<q;i++) {
			int L = Integer.parseInt(sc.next())-1;
			int R = Integer.parseInt(sc.next())-1;
			buf.append((cnt[R]-cnt[L])+s);
		}
		sc.close();
		System.out.println(buf);
	}
}


Measured memory_bytes: 56520
#include<stdio.h>
int main(){
	char str[1202]={0,};
	char alp[26]={0,};
	int i;
	while(fgets(str,1202,stdin) != NULL){
		i=0;
		while(1){
			if(str[i]==0){
				//printf("%dの時 stop(str[%d]=%d)\n",i,i,str[i]);
				break;
			}else if(str[i]>='a' && str[i]<='z'){
				str[i] -= 32;
			}
			if((str[i]>='a' && str[i]<='z') || (str[i]>='A' && str[i]<='Z')){
			alp[str[i]-65] += 1;
			}
			i++;
			
		}
	}
	for(i=0;i<26;i++){
		printf("%c : %d\n",97+i,alp[i]);
	}
}


Measured memory_bytes: 2032
import java.util.Scanner;

public class Main {

  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();

    if (A >= B && A >= C) {
      System.out.println(A * 10 + B + C);
    }else if (B >= C && B >= A) {
    System.out.println(B * 10 + C + A);
  }else  if (C >= A && C >= B){
    System.out.println(C * 10 + B + A);
  }


  }

}


Measured memory_bytes: 21332
import numpy as np
n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')
for i in range(n):
  w, v = map(int, input().split())
  #print(dp[w:],dp[:-w],dp)
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
  #print(dp[w:],dp[:-w],dp)
print(dp[-1])

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

int main(){
    vector<int>v(3);rep(i,3)cin>>v[i];
    sort(v.begin(),v.end());
    int all = 2*v[2]-v[0]-v[1];
    int ans = all%2==0?(all/2):(all/2+2);
    co(ans);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ABC
{
    public static void Main()
    {
        int[] ab = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int r = ab[0];
        int D = ab[1];
        int x2000 = ab[2];

        for (int i = 0; i < 10; i++)
        {
            x2000 = r * x2000 - D;
            Console.WriteLine(x2000);

        }


    }


}

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

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	a *= 100, b *= 10;
	if((a + b + c) % 4) printf( "NO\n" );
	else printf( "YES\n" );
	return 0;
} 

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

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

  string s;
  ll k;
  cin >> s >> k;
  char ans = 'x';
  for (ll i = 0; i < k; ++i) {
    if (s[i] != '1') {
      cout << s[i] << endl;
      return 0;
    }
  }
  cout << 1 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>      // cout, endl, cin
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <iomanip>       // fixed, setprecision
using namespace std;

int main()
{
  int64_t N, Y, mm, gg, sen;
  cin >> N >> Y;
  Y /= 1000;
  for (int man = 0; man <= N; man++)
  {
    mm = man * 10;
    for (int gosen = 0; gosen <= N - man; gosen++)
    {
      gg = gosen * 5;
      sen = N - man - gosen;
      if (mm + gg + sen == Y)
      {
        cout << man << " " << gosen << " " << sen << endl;
        return 0;
      }
    }
  }
  cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 3168
#include<iostream>
#include<string>
#include<climits>
#include<vector>
#include <sstream>
#include<algorithm>
#include<array>
#include<map>

using namespace std;

int main(void) {

	
	long long a, b, c, k;

	cin >> a >> b >> c >> k;
	if (abs(a - b) > 1000000000000000000) {
		cout << "Unfair";
	}
	if (k%2==0) {
		cout << a - b;
	}
	else {
		cout << b - a;
	}

	return 0;

}

Measured memory_bytes: 256
s=gets.chomp
q=gets.to_i
while line=gets
  (c,a,b,p)=line.split
  a=a.to_i
  b=b.to_i
  s1=(a>0) ? s[0..a-1] : ""
  s2=(b<s.size) ? s[b+1..s.size] : ""
  puts s[a..b] if c=="print"
  s=s1 + s[a..b].reverse + s2 if c=="reverse"
  s=s1 + p + s2 if c=="replace"
end

Measured memory_bytes: 6256
#include <stdio.h>
int main(void){
  int n,t,tc[200000],i,l=0,ans=0;
  scanf("%d%d",&n,&t);
  for (i=0;i<n;i++) scanf("%d",&tc[i]);
  for (i=1;i<n;i++){
    if (tc[i]-tc[i-1]>=t){
      ans+=tc[i-1]-tc[l]+t;
      l=i;
    }
  }
  ans+=tc[n-1]-tc[l]+t;
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 896
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	b := make([]int, n-1)
	ans := 0
	for i := 0; i < n-1; i++ {
		fmt.Scan(&b[i])
	}

	for i := 0; i < n-2; i++ {
		ans += min(b[i], b[i+1])
	}
	fmt.Println(ans + b[0] + b[n-2])
}

func min(a, b int) int {
	if a <= b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 512
L, R = map(int, input().split())

tmp = float("INF")
ans = tmp
for i in range(L, R):
  for j in range(i+1, R+1):
    tmp = (i % 2019) * (j % 2019) % 2019
    ans = min(ans, tmp)
    if ans == 0:
      print(0)
      exit()
      
print(ans)

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

typedef long long ll;

int main()
{
    ll n,a,b,c,d,j,i,cal1,a1,b1,c1,d1;
    string st;
    cin >> st;
    a=st[0]-48;
    b=st[1]-48;
    c=st[2]-48;
    d=st[3]-48;


    vector<string>v;
    v.push_back("+++");
    v.push_back("++-");
    v.push_back("+--");

    v.push_back("---");
    v.push_back("--+");
    v.push_back("-++");

    v.push_back("+-+");
    v.push_back("-+-");



    for(i=0; i<v.size(); i++)
    {
        st=v[i];
        a1=a,b1=b,c1=c,d1=d;

        cal1=(st[0]=='+')?a+b:a-b;
        cal1=(st[1]=='+')?cal1+c:cal1-c;
        cal1=(st[2]=='+')?cal1+d:cal1-d;


        if(cal1==7)
        {
            cout << a << st[0] << b << st[1] << c << st[2] << d << "=7\n";
            return 0;
        }

    }



    return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

class Main {

	static final int[] monthDay = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30,
			31 };
	static final String[] dayOfTheWeek = { "Wednesday", "Thursday", "Friday",
			"Saturday", "Sunday", "Monday", "Tuesday" };

	public static void main(String[] args) {
		Scanner sc = null;
		try {
			sc = new Scanner(System.in);
			while (sc.hasNextInt()) {
				int month = sc.nextInt();
				int day = sc.nextInt();
				if (month == 0 || day == 0) {
					break;
				}

				System.out.println(getDayOfTheWeek(month, day));

			}
		} finally {
			sc.close();
		}
	}

	public static String getDayOfTheWeek(int m, int d) {

		int sum = 0;
		for (int i = 0; i < m - 1; i++) {
			sum += monthDay[i];
		}
		sum += d;

		return dayOfTheWeek[sum % 7];
	}
}

Measured memory_bytes: 26272
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let [n,m,c]=t.n(3)
  let b=t.n(m),ans=0
  for(let i=0;i<n;i++){
    let a=t.n(m),sum=0
    for(let j=0;j<m;j++){
      sum+=a[j]*b[j]
    }
    if(sum+c>0)ans++
  }
  t.o(ans)
}
main()

Measured memory_bytes: 7500
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>

using namespace std;
typedef long long LL;
typedef pair<int,int> P;
struct Edge
{
	int a;
	int b;
	LL c;
	LL f;
};
template<int S>
struct Flow
{
vector<Edge> es;
vector<int> edges[S];
void add(int a, int b, LL cap){
	//cout << "add " << a << ", " << b << ", " << cap << endl;
	es.push_back(Edge());
	Edge& e=es.back();
	e.a=a;
	e.b=b;
	e.c=cap;
	e.f=0;
	edges[a].push_back(es.size()-1);
	edges[b].push_back(es.size()-1);
}
void init(){
	es.clear();
	for(int i=0;i<S;i++){
		edges[i].clear();
	}
}
LL fill(int s, int t, int sz=S){
	LL ret=0;
	int pre[S];
	int Q[S];
	while(1){
		memset(pre,-1,sizeof(int)*sz);
		int qs=0;
		Q[0]=s;
		pre[s]=-2;
		int qe=1;
		while(qs<qe&&pre[t]==-1){
			int p=Q[qs++];
			for(int i=0;i<edges[p].size();i++){
				int j=edges[p][i];
				int nex;
				if(es[j].a==p){
					if(es[j].f==es[j].c){
						continue;
					}
					nex=es[j].b;
				}
				else{
					if(es[j].f==0){
						continue;
					}
					nex=es[j].a;
				}
				if(pre[nex]==-1){
					Q[qe++]=nex;
					pre[nex]=j;
				}
			}
		}
		if(pre[t]==-1){
			return ret;
		}
		{
			int p=t;
			LL f=LLONG_MAX;
			while(p!=s){
				int j=pre[p];
				if(es[j].b==p){
					f=min(f,es[j].c - es[j].f);
					p=es[j].a;
				}
				else{
					f=min(f,es[j].f);
					p=es[j].b;
				}
			}
			p=t;
			while(p!=s){
				int j=pre[p];
				if(es[j].b==p){
					es[j].f+=f;
					p=es[j].a;
				}
				else{
					es[j].f-=f;
					p=es[j].b;
				}
			}
			ret+=f;
		}
	}
	// ここには来ない
	return -1;
}
};


int main() {
	int N;
	cin >> N;
	Flow<102> f;
	LL ret=0;
	for(int i=1;i<=N;i++){
		for(int j=2*i;j<=N;j+=i){
			f.add(j,i,1LL<<60);
		}
		LL a;
		cin >> a;
		if(a>0){
			f.add(0,i,a);
			ret+=a;
		}
		if(a<0){
			f.add(i,N+1,-a);
		}
	}
	cout << ret-f.fill(0,N+1) << endl;

	return 0;
}



Measured memory_bytes: 256
W, H, N = map(int,input().split())

X=[]
Y=[]
A=[]


for i in range(N):
    x, y, a = map(int,input().split())
    X.append(x)
    Y.append(y)
    A.append(a)  

yoko1=0
yoko2=W
tate1=0
tate2=H

for j in range(N):
    if A[j]==1:
        if yoko1<X[j]:
            yoko1=X[j]
    
    elif A[j]==2:
        if yoko2>X[j]:
            yoko2=X[j]
        
    elif A[j]==3:
        if tate1<Y[j]:
            tate1=Y[j]

    elif A[j]==4:
        if tate2>Y[j]:
             tate2=Y[j]

ans=(tate2-tate1)*(yoko2-yoko1)

if (tate2-tate1)<0 or (yoko2-yoko1)<0:
    print(0)
else:
    print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>

using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}

using int64 = long long;

int main() {
    int d,t,s;
    cin >> d >> t >> s;
    if (s*t >= d) {
        cout << "Yes" << endl;
    } else {
        cout << "No"<<endl;
    }
}

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

int main(){
    long long  n ,a , b; 
    long long  res = 0, mod = 0;
    cin >> n >> a >> b;

    if(a + b == 0){
        cout << res << endl;
        return 0;
    }

    res =  (long long)(n / (a + b)) * a;
    if(n % (a + b) > 0 && a > 0){
        if(n % (a + b) >= a){
            res += a;
        }else{
            res += n % (a + b);
        }
    }

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

Measured memory_bytes: 256
#include<iostream>

int main() {
	int n,m,a,b,c,d;
	std::cin >> n;

	if (n % 4 == 0 || n%7==0||n==11) {
		std::cout << "Yes" << std::endl;
		exit(0);
	}

	for (int i = 1; i <n/7; i++) {
		m = n - 7 * i;
		if (m % 4 == 0) {
			std::cout << "Yes" << std::endl;
			exit(0);
		}
	}

	std::cout << "No" << std::endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using namespace std;
using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
template<class T> T count_bit(T p){
  if(typeid(p)==typeid(int))return __builtin_popcount(p);
  else if(typeid(p)==typeid(long))return __builtin_popcountl(p);
  else return __builtin_popcountll(p);
}
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}

inline void solve(void){
  long W,H,X,Y;
  double EPS=1e-10;
  in(W,H,X,Y);
  printf("%.10f ",0.5*W*H);
  if((abs(X-(double)W/2.0)<EPS&&abs(Y-(double)H/2.0)<EPS))puts("1");
  else puts("0");
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REPR(i, n) for(int i = (n); i >= 0; i--)
#define FOR(i, m, n) for(int i = (m); i < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << ": " << x << endl;

using namespace std;
typedef long long ll;

signed main() {
  int n;
  ll ans;
  cin >> n;
  vector<ll> a(n), b(n);
  REP(i, n) cin >> a[i] >> b[i];

  sort(ALL(a));
  sort(ALL(b));

  if(n % 2 == 1) {
    ll l = a[(n + 1) / 2 - 1];
    ll r = b[(n + 1) / 2 - 1];
    if(r - l >= 0) {
      ans = r - l + 1;
    } else {
      ans = 0;
    }
  } else {
    long double l = (long double)(a[n / 2 - 1] + a[n / 2]) / 2.0;
    long double r = (long double)(b[n / 2 - 1] + b[n / 2]) / 2.0;
    if(r - l >= 0) {
      ans = (ll)((r - l) / 0.5) + 1;
    } else {
      ans = 0;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6424
import java.util.*;
public class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    String str = sc.next();

    if (str.equals("A")) {
      System.out.println("T");
    }

    if (str.equals("T")) {
      System.out.println("A");
    }

    if (str.equals("G")) {
      System.out.println("C");
    }

    if (str.equals("C")) {
      System.out.println("G");
    }
  }
}


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

int main(){
  int64_t H, W;
  cin >> H >> W;
  int64_t Ans=H*W;
  int64_t A, B, C;
  for(int64_t i=1; i<H; i++){
    A=i*W;
    B=(H-i)*(W/2);
    C=H*W-A-B;
    Ans=min(Ans, max(A, max(B, C))-min(A, min(B, C)));
  }
  for(int64_t j=1; j<W; j++){
    A=j*H;
    B=(W-j)*(H/2);
    C=H*W-A-B;
    Ans=min(Ans, max(A, max(B, C))-min(A, min(B, C)));
  }
  if(H%3==0 || W%3==0){
    Ans=0;
  }
  else{
    Ans=min(Ans, min(H, W));
  }
  cout << Ans << endl;
}

Measured memory_bytes: 256
#import <Foundation/Foundation.h>
int main(){
    int a,b;
    scanf("%d %d",&a,&b);
    NSArray *A = @[@1,@3,@5,@7,@8,@10,@12];
    NSArray *B = @[@4,@6,@9,@11];
    printf((([A containsObject:@(a)] && [A containsObject:@(b)])) || (([B containsObject:@(a)] && [B containsObject:@(b)])) ? "Yes":"No");
}


Measured memory_bytes: 6532
class Event:
    def __init__(self, name_, type_, time_):
        self.time = time_
        self.etype = type_
        self.name = name_
    def __lt__(self, other):
        if self.time != other.time:
            return self.time < other.time
        if self.etype != other.etype:
            return self.etype > other.etype
        return self.time < other.time
    def __str__(self):
        return '{0} {1} {2}'.format(
            self.name, self.etype, self.time)

while 1:
    n = input()
    if n==0 : break

    evs = [0]*2*n
    for i in range(n):
        la = raw_input().split(' ')
        for j in range(2):
            t = map(int,la[j].split(':'))
            t = (t[0]*60+t[1])*60+t[2]
            evs[i*2+j] = Event(i, j, t)
    evs.sort()

    ans = 0
    cur = 0
    for i in evs:
        if i.etype == 0:
            cur+=1
            ans = max(cur, ans)
        else:
            cur-=1
        # print i
    print ans

Measured memory_bytes: 12156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public static void Main(string[] args)
	{
		string[] inputs = Console.ReadLine().Split(' ');
		int a = int.Parse(inputs[0]);
		int b = int.Parse(inputs[1]);
		int t = int.Parse(inputs[2]);
		Console.WriteLine(t/a*b);
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}


}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1000005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15

/* Debug Begins */ 
# define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
  stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
string to_string(char c) { return "'" + string(1, c) + "'";}
string to_string(string s) { return '"' + s + '"';}
string to_string(bool f) { if(f) return "True"; else return "False";}
string to_string(const char* s) { return to_string((string) s);}
template<typename A> string to_string(A);
template<typename A, typename B> string to_string(pair<A, B> p){
  return "(" + to_string(p.first) + ": " + to_string(p.second) + ")";}
template<typename A> string to_string(A v) {bool f = false; string r = "{"; 
  for (auto x: v) {if (f) r += ", "; r += to_string(x); f = true;} return r += "}";}
template<typename A> string to_string(vector<vector<A>> v) {string r; 
  for (auto x: v) r += "\n" + to_string(x); return r;}
int Nerr;
template<typename A> string to_string(A *p) {return to_string(vector<A>(p, p + Nerr));}
void err(istream_iterator<string>) { cerr << endl; }
template<typename T,typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << to_string(a) << "; "; err(++it, args...); }
template<typename T> void kek(T ans) {cout << ans << endl; exit(0);}
#define Lu(...) [&] (auto &&u) { return __VA_ARGS__; }
#define Luv(...) [&] (auto &&u, auto &&v) { return __VA_ARGS__; }
/***************************************************************/



signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        char c;
        cin >> c;
        if(c >= 97) cout << 'a';
        else cout << 'A';
    }
}

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



int main() {
    int H,N;
    cin>>H>>N;
    int ans=0;
    vector<int> A(N);
    rep(i,N){
        cin>>A.at(i);
        ans+=A.at(i);
    }
    if(ans>=H){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    return 0;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,sum=0,not10=0;
    cin >> n;
    vll s(n);
    rep(i,n){
        cin >> s[i];
        sum += s[i];
        if(s[i]%10 != 0)not10++;
    }
    sort(all(s));
    if(sum % 10 == 0){
        if(not10 == 0)sum=0;
        else{
            rep(i,n){
                if(s[i] % 10 == 0)continue;
                if(sum % 10 != 0)break;
                else{
                    sum -= s[i];
                    break;
                }
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
package main

import (
    "bufio"
    "fmt"
	"os"
	"strings"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	var N,M int
	fmt.Scan(&N,&M)
	var A string
  	buf := make([]byte, 1000000)
  	sc.Buffer(buf, 1000000000)
	if sc.Scan() {
		A = sc.Text()
	}
	max := 0
	var diff,val_before,A_0 int
	var distace_diff []int
	for index, i := range strings.Fields(A) {
		value, _ := strconv.Atoi(i)
		if index > 0{
			diff = value - val_before
			distace_diff = append(distace_diff,diff)
			if max < diff{
				max = diff
			}
		} else {
			A_0 = value
		}
		if len(distace_diff) == M-1 {
			distace_diff = append(distace_diff,A_0 + (N - value))
			diff = A_0 + (N - value)
			if max < diff{
				max = diff
			}
		}
		val_before = value
	}
	var count int
	var total int 
	for _,i := range distace_diff {
		if (count == 0 ) && (i == max){
			count += 1
		} else {
			total += i
		}
	}
	fmt.Println(total)
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> v(100001);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    v[a[i]]++;
  }
  int ans = 0;
  for (int i = 1; i < v.size(); i++) {
    ans = max(ans, v[i - 1] + v[i] + v[i + 1]);
  }
  cout << ans << endl;
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int n, a;
  cin >> n >> a;
  cout << ((n % 500 <= a) ? "Yes" : "No");
}

int main()
{
  fastio;
  solve();

  return 0;
}

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

int main(void) {
  int lower,upper,multi;
  bool flag=false;
  cin>>multi>>lower>>upper;
  for(int k=multi;k<=upper;k+=multi){
    if(lower>k) continue;
    flag=true;
    break;
  }
if(flag) cout<<"OK"<<endl;
else cout<<"NG"<<endl;

  return 0;
}


Measured memory_bytes: 3128
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        int N = sc.nextInt();
        int H = sc.nextInt();
        int[] slay_damages = new int[N];
        Integer[] throw_damages = new Integer[N];
        int slaydmg_max = 0;
        for(int i = 0; i < N; i++){
            slay_damages[i] = sc.nextInt();
            if(slaydmg_max < slay_damages[i]){
                slaydmg_max = slay_damages[i];
            }
            throw_damages[i] = sc.nextInt();
        }
        
        Arrays.sort(throw_damages, Collections.reverseOrder());
        
        int ans = 0;
        for(int i = 0; i < N; i++){
            if(slaydmg_max < throw_damages[i]){
                H -= throw_damages[i];
                ans++;
                if(H<=0){
                    break;
                }
            } else{
                break;
            }
        }
        
        if(H>0){
            ans += H%slaydmg_max==0 ? (int)(H/slaydmg_max) : (int)(H/slaydmg_max)+1;
        }
        
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 93536
#include <stdio.h>
#define NIL -1

struct Node{
  int parent;
  int left;
  int right;
};
struct Node T[25];

void Preorder(int);
void Inorder(int);
void Postorder(int);

int main()
{
  int n, i, j, id, left, right, root;


  scanf("%d",&n);
  for( i=0 ; i<n ; i++ ){
    T[i].parent = NIL;
  }

  for( i=0 ; i<n ; i++ ){
    scanf("%d %d %d",&id,&left,&right);
    T[id].left = left;
    T[id].right = right;
    if(left!=NIL)
      T[left].parent = id;
    if(right!=NIL)
      T[right].parent = id;
  }

  for( i=0 ; i<n ; i++ ){
    if(T[i].parent==NIL) 
      root = i;
  }

  

  printf("Preorder\n");
  Preorder(root);
  printf("\n");

  printf("Inorder\n");
  Inorder(root);
  printf("\n");

  printf("Postorder\n");
  Postorder(root);
  printf("\n");

  return 0;
}

void Preorder(int u)
{
  if(u==NIL) return;
  printf(" %d",u);
  Preorder(T[u].left);
  Preorder(T[u].right);
}

void Inorder(int u)
{
  if(u==NIL) return;
  Inorder(T[u].left);
  printf(" %d",u);
  Inorder(T[u].right);
}

void Postorder(int u)
{
  if(u==NIL) return;
  Postorder(T[u].left);
  Postorder(T[u].right);
  printf(" %d",u);
}

Measured memory_bytes: 616
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		int a=0, b=0, ab=0, o=0;
		for(; sc.hasNext();){
			String s=sc.nextLine().split(",")[1];
			if(s.equals("A"))
				a++;
			else if(s.equals("B"))
				b++;
			else if(s.equals("AB"))
				ab++;
			else
				o++;
		}
		println(a+"");
		println(b+"");
		println(ab+"");
		println(o+"");
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define MOD 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;

int dp[100005]={0},vis[100005]={0};

void dfs(vector<int> adj[],int s)
{
	vis[s]=1;
	
	for(int i=0;i<adj[s].size();i++)
	{
		if(vis[adj[s][i]]==0)
		{
			dfs(adj,adj[s][i]);
		}
		
		dp[s]=max(dp[s],dp[adj[s][i]]+1);
	}
}

main()
{
	IO;
	int n,m,x,y;
	cin>>n>>m;
	
	vector<int> adj[n+1];
	
	for(int i=0;i<m;i++)
	{
		cin>>x>>y;
		adj[x].push_back(y);
	}
	
	int ans=0;
	
	for(int i=1;i<=n;i++)
	{
		if(vis[i]==0)
		{
			dfs(adj,i);
			ans=max(ans,dp[i]);
		}
	}
	
	cout<<ans;
	
	
}

Measured memory_bytes: 8576
function main(){
  var waitTime = [0,0,0,0,0,0,14,9,4,0,0,8,3,2,0,0,15,10,15,10,6,12,7,9,11,6,23,18,13,8,3,23,18,13,8,3,34,29,24,22,17,28,23,24,19,27,34,29,35,30,28,31,28,23,24,28,42,37,32,27,22,42,37,32,27,22,53,48,43,41,36,47,42,43,38,46,64,59,54,49,44,61,56,51,46,44,72,67,62,57,52,72,67,62,57,52,83,78,73,71];
  for(var i = 0; i < (input.length - 1); i++){
    console.log(waitTime[parseInt(input[i], 10)]);
  }
}

var
input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main();
});

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

using namespace std;

string unite(const string& s) {
  string res;
  for (char c : s) {
    if (!res.empty() && res.back() == c) {
      continue;
    } else {
      res += c;
    }
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  cout << unite(s).size() << endl;
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
const int MAX = 1e4;

int main(){
  int n,d[MAX+1];

  while(cin >> n ,n){
    int num = 0;
    bool flg = false;

    for(int i = 0 ; i < n ; i++){
      cin >> d[i];
      if(d[i] > 1) flg = true;
      if(d[i]) ++num;
    }
    if(!flg) cout << "NA" << endl;
    else cout << ++num << endl;
  }

  return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	ll n;
	cin >> n;
	++n;
	vi s;
	int i = 63 - __builtin_clzll(n);
	rep(j,1,i+1) s.insert(s.begin(),j);
	rep(j,1,i+1) s.insert(s.begin(),j);
	n -= 1LL<<i;
	++i;
	while(n){
		int j = 63 - __builtin_clzll(n);
		s.insert(s.end()-j, i++);
		s.insert(s.begin(), i-1);
		n -= 1LL<<j;
	}
	cout << sz(s) << endl;
	trav(x, s) cout << x << ' ';
}

Measured memory_bytes: 256
use std::io::{stdin, BufRead};
fn main() {
    let stdin = stdin();
    let mut stdinlock = stdin.lock();
    let mut n = String::new();
    let _ = stdinlock.read_line(&mut n);
    let n: usize = n.trim().parse().expect("N");
    let mut v: Vec<u32> = Vec::with_capacity(n);
    for line in stdinlock.lines() {
        v.push(line.expect("line").trim().parse().expect("parse"));
    }
    v.sort();
    let mut n: u32 = 0;
    let mut current = v[0];
    let mut oddness = true;
    for &ai in &v[1..] {
        if ai == current {
            oddness = !oddness;
        } else {
            if oddness {
                n += 1;
            }
            current = ai;
            oddness = true;
        }
    }
    if oddness {
        n += 1;
    }
    println!("{}", n);
}


Measured memory_bytes: 2500
N, K = input().strip().split()
Ds = set(input().strip().split())

price = N
roop_flag = True
while(roop_flag):
    roop_flag = False
    for d in Ds:
        if(d in price):
            price = str(int(price) + 1)
            roop_flag = True
            break
print(price)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>

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

int main() {
	// input
	int N;
	cin >> N;
	vector<int> a(N);

	rep(i, N) cin >> a[i];
	sort(a.begin(), a.end());

	// 全て0
	int num0=0;
	int numM=0;
	rep(i, N) {
		if(a[i]==0) num0++;
		else if(a[i]==a[N-1]) numM++;
	}
	if(num0==N) { // 全部ゼロ
		cout << "Yes" << endl;
		return 0;
	}

	if(N%3>0) {
		cout << "No" << endl;
		return 0;
	}

	// N/3枚が0, のこりがx
	if(N/3==num0 && 2*N/3==numM) {
		cout << "Yes" << endl;
		return 0;
	}

	// uniqueな数
	vector<int> c(N);
	copy(a.begin(), a.end(), c.begin());
	c.erase( unique(c.begin(), c.end()), c.end()); // uniqueなものに限定

	if(c.size()!=3) {
		cout << "No" << endl;
		return 0;
	}

	if((c[0]^c[1]^c[2])==0) {
		int c1=0, c2=0, c3=0;
		rep(i, N) {
			if(c[0]==a[i]) c1++;
			else if(c[1]==a[i]) c2++;
			else if(c[2]==a[i]) c3++;
		}
		if(c1==c2 && c2==c3) {
			cout << "Yes" << endl;
			return 0;
		} else {
			cout << "No" << endl;
			return 0;
		}

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

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;


int Max(int n,int K,int c[]){
  int k,l,CK,M=0;
 for(k=0;k<n-K+1;k++){
	CK=1;
	for(l=k;l<k+K;l++){
	  CK*=c[l];
	}
	if(CK>M)M=CK;
      }
 return M;
}

int main(){
  int n,K,M1,M2,tmp,cnt=0;
  int i,j;
  int c[100];
  while(cnt<100){
    cnt++;
  cin >> n >> K;
  if(n==0&&K==0)break;
  for(i=0;i<n;i++)cin>>c[i];
  M1=0;
  M2=0;
  if(M1<Max(n,K,c)) M1=Max(n,K,c);
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      tmp=c[i];
      c[i]=c[j];
      c[j]=tmp;
  if(M2<Max(n,K,c))M2=Max(n,K,c);
      tmp=c[i];
      c[i]=c[j];
      c[j]=tmp;
    }
  } 
  if(M1<=M2)cout<<M2-M1<<endl;
  else cout << "NO GAME"<<endl;
  }
  return 0;
}

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

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

    vector<long long int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());

    long long int ans = 0, e1  = 0;
    for(int i=n-1; i>=1; i--){
        //cout << i << " ";
        if(a[i] == a[i-1]){
            if(e1 == 0){
                e1 = a[i];
                i -= 1;
            }
            else{
                ans = e1 * a[i];
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

using ll = long long;

#define for_(i, a, b) for(int i = (a);i < (b);++i)
#define rfor_(i, a, b) for(int i = (b)-1;i >= (a);--i)
#define rep(i, n) for_(i, 0, n)
#define rrep(i, n) rfor_(i, 0, n)

int H, W;

char a[102][102];

bool t[102], y[102];

int main() {
  cin.tie(0);cout.tie(0);
  ios_base::sync_with_stdio(false);
  
  cin>>H>>W;
  
  rep(i, H)rep(j, W) {
    cin>>a[i][j];
    if(a[i][j]=='#')t[i] = y[j] = true;
  }
  
  rep(i, H) {
  	if(!t[i])continue;
  	rep(j, W) {
      if(!y[j])continue;
      cout<<a[i][j];
    }
    cout<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 384
// ↓ここから
#include <string>
#include <vector>
#include <iostream>
#ifdef USE_PYTHON_LIKE_PRINT
#include "print.h"
#else
template<char SEP = ' ', char END = '\n'> inline void print(...){}
template<char SEP = ' ', char END = '\n'> inline void printe(...){}
template<char SEP = ' ', char END = '\n'> inline void printo(...){}
#define define_print(...)
#define define_print_with_names(...)
#define define_to_tuple(...)
#endif
// ↑ここまで

#include <string.h>

using namespace std;

const int Alphabets = 26;

class TreeNode{
public:
	vector<TreeNode*> children;
	vector<int> counts;
	vector<bool> leaves;
	int count;
	TreeNode(): children(Alphabets, nullptr), counts(Alphabets, 0), count(0), leaves(Alphabets, 0){
	}
	void append(const string& s, int index){
		count ++;
		if(index < 0){
			return;
		}
		const int c = s[index] - 'a';
		if(index == 0){
			leaves[c] = true;
		}
		if(children[c] == nullptr){
			children[c] = new TreeNode();
		}
		children[c]->append(s, index - 1);
	}
	void prepare_counts(){
		for(int i = 0; i < Alphabets; i ++){
			TreeNode* child = children[i];
			if(child){
				child->prepare_counts();
				for(int j = 0; j < Alphabets; j ++){
					if(i == j){
						counts[i] += child->count;
					}else{
						counts[j] += child->counts[j];
					}
				}
			}
		}
	}
	long long calc_total(){
		long long total = 0;
		for(int i = 0; i < Alphabets; i ++){
			if(leaves[i]){
				total += counts[i];
			}
			auto* child = children[i];
			if(child){
				total += child->calc_total();
			}
		}
		return total;
	}
	void print(const string s){
		for(int i = 0; i < Alphabets; i ++){
			string x;
			x += ('a' + i);
			x += s;
			if(children[i]){
				children[i]->print(x);
			}
			if(counts[i] != 0){
				string y;
				y += ('a' + i);
				printe("t", y, s, counts[i]);
			}
		}
	}
};

int main(void){
	int N;
	cin >> N;
	
	TreeNode root;
	vector<bool> single_chars(Alphabets, false);
	for(int i = 0; i < N; i ++){
		string S;
		cin >> S;
		root.append(S, S.size() - 1);
	}
	
	root.prepare_counts();
//	root.print("#");
	
	long long total = root.calc_total() - N;
//	printe(total);
	
	cout << total << endl;
	
	return 0;
}



Measured memory_bytes: 527264
#include <bits/stdc++.h>
using namespace std;
int main() {
    int n,k;
    cin>>n>>k;
    long long ans[n];
    int h[n];
    for(int i=0;i<n;i++)
        ans[i]=1000000000000000;
    for(int i=0;i<n;i++)
        cin>>h[i];
    ans[0]=0;
    ans[1]=abs(h[1]-h[0]);


    for(int i=2;i<n;i++)
        for(int j=max(0,i-k);j<i;j++)
            ans[i]=min(ans[i],ans[j]+abs(h[i]-h[j]));



    cout<<ans[n-1];
}


Measured memory_bytes: 4708
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1000000007;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}

/* main */

int main() {
	int h, w, f = 1, a[] = { -1,0,1,0 }, b[] = { 0,1,0,-1 };
	char s[50][51];
	scanf("%d%d", &h, &w);
	REP(i, h)scanf("%s", &s[i]);
	REP(i, h)REP(j, w) {
		if (s[i][j] == '.') continue;
		int c = 0;
		REP(k, 4) if (s[i + a[k]][j + b[k]] == '#')c = 1;
		if (c == 0) f = 0;
	}
	Yes(f);
	return 0;
}


Measured memory_bytes: 128
import itertools


def solve():
    a, b, c = input().split()
    v = itertools.permutations([a, b, c], 3)
    max_a = 0
    for e1, e2, e3 in v:
        a = max(eval(e1 + "+" + e2 + e3), eval(e1 + e2 + "+" + e3))
        if a > max_a:
            max_a = a
    return max_a


if __name__ == "__main__":
    print(solve())


Measured memory_bytes: 3060
#include "bits/stdc++.h"
using namespace std;

int main() {
	string S;
	cin >> S;
	bool bret = true;
	for (int n = 0;n<3; ++n) {
		if (S[n] ==S[n+1]) {
			bret = false;
		}
	}
	if (bret) {
		cout << "Good" << endl;
	}
	else {
		cout << "Bad" << endl;
	}
	
	return 0;
}

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

namespace ABC157
{
    class C
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = input[0];
            var M = input[1];
            var sc = Enumerable.Repeat(0, M).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();

            for (int i = 0; i < 1000; i++)
            {
                var s = i.ToString();
                if (s.Length != N) continue;
                if (!sc.All(x => s[x[0] - 1] - '0' == x[1])) continue;
                Console.WriteLine(i);
                return;
            }
            Console.WriteLine(-1);
        }
    }
}

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

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

    vector<int> c(n), s(n), f(n);
    for(auto i = 0; i < n; i++) cin >> c[i] >> s[i] >> f[i];

    for (auto i = 0; i < n; i++) {
        auto t = s[i] + c[i];
        for (auto j = i + 1; j < n; j++) {
           if(s[j] >= t) t = s[j] + c[j];
           else {
               if((t - s[j]) % f[j] == 0) t += c[j];
               else t += f[j] - (t % f[j]) + c[j];
           }
        }
        cout << t << endl;
    }

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

Measured memory_bytes: 3624
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main(void){
  int x,a,b;
  cin >> x >> a >> b;
  
  if(abs(x - a) > abs(x - b))
    cout << "B" << endl;
  else
    cout << "A" << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>

int main(){
    int A, B;
    std::cin >> A >> B;
    int now = 1;
    int need = 0;
    while(now < B){
        now = now - 1 + A;
        need++;
    }
    std::cout << need << std::endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        int c = Integer.parseInt(sc.next());

        // 主処理
        boolean judge = c <= a + b;
        String result = judge ? "Yes" : "No";

        // 出力
        System.out.println(result);
        sc.close();
    }
}


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

const ll INF = 1e18;
const int MX = 2005;

int main() {
  ll x;
  cin >> x;
  ll ansa = 0,ansb = 0;
  rep(a,500){
    rep(b,500){
      int A = a-125;
      int B = b-125;
      if(A!=B){
        if(x%(A-B) == 0){
          if(A*A*A*A + A*A*A*B + A*A*B*B + A*B*B*B + B*B*B*B == x / (A-B)){
            ansa = A;
            ansb = B;
          }
        }
      }
    }
  }
  cout << ansa << " " << ansb << endl;
}

Measured memory_bytes: 3636