akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		int[] i = {
				Integer.parseInt(s.next()),
				Integer.parseInt(s.next()),
				Integer.parseInt(s.next())
				};
		Arrays.sort(i);
		System.out.print  (i[0]);
		System.out.print  (" ");
		System.out.print  (i[1]);
		System.out.print  (" ");
		System.out.println(i[2]);
	}
}

Measured memory_bytes: 26068
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner scanner = new Scanner(System.in);

        String S = scanner.next();

        String postfix = S.charAt(S.length() - 1) == 's' ? "es" : "s";
        System.out.println(S + postfix);
    }
}

Measured memory_bytes: 26888
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int n, x, hai,cnt=1;
vector<int> LLL(100);

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


	for (int i = 0; i < n; i++){
		if (hai > x){
			cnt--;
			goto label;
		}
		hai += LLL[i];
		cnt++;
	}
	if (hai > x){ cnt--; }
label:
	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 256
//52行目から編集
#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<int> > vvi;
typedef vector<vector<ll> > vvl;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;

template<class T> bool chmin(T& a,T b){if(a > b){a = b;return true;}else return false;}
template<class T> bool chmax(T& a,T b){if(a < b){a = b;return true;}else return false;}
///////////////////////////////////////////////////////////

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    int n;cin >> n;
    map<ll,ll> m;
    vi a(n);
    rep(i,n){
        cin >> a[i];
        m[a[i]]++;
    }
    ll ans = 0;
    for(auto i : m){
        ans += (i.second)*(i.second - 1)/2;
    }
    rep(i,n){
        if(m[a[i]]>= 2){
           ll k = m[a[i]];
           ll res = ans;
           res -= k*(k-1)/2;
           res += (k-1)*(k-2)/2;
           cout << res << '\n';
        }else{
            cout << ans << '\n';
        }
    }
    return 0;
}



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

int main(int argc, const char * argv[]) {
    int m,f,r;

    while(1){
        cin>>m; //中間テスト
        cin>>f; //期末テスト
        cin>>r; //再試験
        if(m==-1 && f==-1 &&r==-1)
            break;
        
        
        if(m==-1||f==-1){
            cout<<"F"<<endl;
        }else if((m+f)>=80){
            cout<<"A"<<endl;
        }else if((m+f)>=65){
            cout<<"B"<<endl;
        }else if((m+f)>=50){
            cout<<"C"<<endl;
        }else if((m+f)>=30){
            if(r>=50){
                cout<<"C"<<endl;
            }else{
            cout<<"D"<<endl;
            }
            
        }else if((m+f)<30){
            cout<<"F"<<endl;
        }
    }
 
    return 0;
    
}



Measured memory_bytes: 3116
#include<cstdio>
#include<algorithm>
#include<functional>
#include<cmath>
#define NN 3000*(3000-1)/2
using namespace std;
typedef pair<double,double> PP;
typedef pair<int,int> PP2;
PP aa[NN];
int main(void)
{
	int n,k,a,b,c,x[3000],y[3000];
	int i,j,p1,p2,flg,mx,cnt;
	double a1,b1;
	PP2 bb[3000];
	scanf("%d %d",&n,&k);
	for(i=0;i<n;i++)	scanf("%d %d",&x[i],&y[i]);
	flg=0;
	for(i=0;i<n;i++)	{
		bb[i].first=x[i];	bb[i].second=y[i];
	}
	sort(bb,bb+n);
	cnt=1;	mx=1;
	for(i=1;i<n;i++)	{
		if(bb[i].first==bb[i-1].first)	{
			cnt++;	
			mx=max(cnt,mx);
		}
		else {
			cnt=1;
		}
	}
	if(mx>=k)	flg=1;
	for(i=0;i<n;i++)	swap(bb[i].first,bb[i].second);
	sort(bb,bb+n);
	cnt=1;	mx=1;
	for(i=1;i<n;i++)	{
		if(bb[i].first==bb[i-1].first)	{
			cnt++;	
			mx=max(cnt,mx);
		}
		else {
			cnt=1;
		}
	}
	if(mx>=k)	flg=1;	
	if(flg==0)	{
		p1=0;	
		for(i=0;i<n-1;i++)	{
			for(j=i+1;j<n;j++)	{
				if(y[i]!=y[j] && x[i]!=x[j])	{
					a=x[i]-x[j];
					b=y[i]-y[j];
//					printf("a=%d b=%d\n",a,b);
					aa[p1].first=(double)b/a;
					aa[p1].second=(double)y[j]-(double)b/a*x[j];
					p1++;
				}
			}
		}
	}
//	for(i=0;i<p1;i++)	printf("%lf %lf\n",aa[i].first,aa[i].second);	
	sort(aa,aa+p1);
	cnt=1; mx=1;
	for(i=1;i<p1;i++)	{
		a1=fabs(aa[i].first-aa[i-1].first);
		b1=fabs(aa[i].second-aa[i-1].second);
		if(a1<0.000001 && b1<0.000001)	{
			cnt++;
			mx=max(mx,cnt);
		}
		else {
			cnt=1;
		}
	}
	if(mx>=k*(k-1)/2)	flg=1;

	printf("%d\n",flg);
	return 0;
}
	


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

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

const long long MOD = 1000000007;

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll ans=0,t=0,M=7+1e9;
  rep(i,n){
    cin >> a.at(i);
    t += a.at(i);
    t %= M;
  }
  rep(i,n){
    t -= a.at(i);
    t += M;
    t %= M;
    ans += t*a.at(i);
    ans %= M;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4824
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
 
namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new ABC123().SolveC(new ConsoleInput(Console.In, ' '));
        }
    }
 
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
 
    public static class AtCoderLib
    {
        // ユークリッドの互除法 
        public static int Gcd(int a, int b)
        {
            if (a < b)
                // 引数を入替えて自分を呼び出す
                return Gcd(b, a);
            while (b != 0)
            {
                var remainder = a % b;
                a = b;
                b = remainder;
            }
            return a;
        }
    }
  class ABC123
    {
        public void SolveC(ConsoleInput cin)
        {
            var n = cin.ReadLong;
            var wayList = new long[5];
            for (int i = 0; i < 5; i++)
            {
                wayList[i] = cin.ReadLong;
            }
            if (n % wayList.Min() == 0) WriteLine(n / wayList.Min() + 4);
            else WriteLine(n / wayList.Min() + 5);
            ReadLine();
        }
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

int main() {
	int n;
	cin >> n;
	map<int,int>temp;
	for (int i = 3; i < n + 1; i += 3) {
		temp[i]++;
	}
	for (int i = 5; i < n + 1; i += 5) {
		temp[i]++;
	}

	ll ans = 0;
	for (int i = 1; i < n + 1; i++) {
		if (temp[i] == 0) {
			ans += i;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 50400
#include<stdio.h>
#include<string.h>

int main(void)
{
	char w[7];
	
	scanf("%s",w);
	if(strcmp(w,"Sunny")==0)
		printf("Cloudy");
	if(strcmp(w,"Cloudy")==0)
		printf("Rainy");
	if(strcmp(w,"Rainy")==0)
		printf("Sunny");
	return 0;
}
	


Measured memory_bytes: 128
#include <cstdio>
#include <vector>


#define maxn 120000
#define ll long long


int main()
{

    int d,n;
    int x = 1;
    scanf("%d%d", &d, &n);
    for (int i = 1; i <=d; i++) {
        x = x * 100;
    }
    if (n != 100)
        printf("%d", x * n);
    else {
        int k = x;
        x = n * x + k;
        printf("%d", x);
        }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using pii=pair<int,int>;
using ll=long long;

#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define MOD 1000000007

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main() {
	double N;
	cin >> N;
	for(double i=1; i<=50000; i+=1) {
		if ((int)((i * 1.08)/1.0) == N) {
			cout << (int)i << endl;
			return 0;
		}
	}
	cout << ":(" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#define INF 1 << 30
using namespace std;
typedef pair<int, int> PII;
typedef vector<PII> VP;
typedef VP::iterator VPI;

int n, ans;
int puzzle[31]; //not use 0;

void swp(int x, int y)
{
	int hoge = puzzle[x];
	puzzle[x] = puzzle[y];
	puzzle[y] = hoge;
	return;
}

bool judge()
{
	if (puzzle[1] == puzzle[2] &&
		puzzle[1] == puzzle[3] &&
		puzzle[1] == puzzle[4] &&
		puzzle[1] == puzzle[5] &&
		puzzle[1] == puzzle[6] &&
		puzzle[1] == puzzle[7] &&
		puzzle[1] == puzzle[8] &&
		puzzle[1] == puzzle[9] &&
		puzzle[10] == puzzle[11] &&
		puzzle[10] == puzzle[12] &&
		puzzle[13] == puzzle[14] &&
		puzzle[13] == puzzle[15] &&
		puzzle[16] == puzzle[17] &&
		puzzle[16] == puzzle[18] &&
		puzzle[19] == puzzle[20] &&
		puzzle[19] == puzzle[21] &&
		puzzle[22] == puzzle[23] &&
		puzzle[22] == puzzle[24] &&
		puzzle[22] == puzzle[25] &&
		puzzle[22] == puzzle[26] &&
		puzzle[22] == puzzle[27] &&
		puzzle[22] == puzzle[28] &&
		puzzle[22] == puzzle[29] &&
		puzzle[22] == puzzle[30]){
		return true;
	}
	return false;
}

void solve(int times)
{
	if (judge()){
		ans = min(ans, times);
		return;
	}
	if (times >= 8) return;
	{
		swp(13, 18);
		swp(7, 22);
		swp(8, 23);
		swp(9, 24);
		swp(10, 12);
		solve(times + 1);
		swp(13, 18);
		swp(7, 22);
		swp(8, 23);
		swp(9, 24);
		swp(10, 12);
	}
	{
		swp(21, 10);
		swp(1, 24);
		swp(4, 27);
		swp(7, 30);
		swp(16, 18);
		solve(times + 1);
		swp(21, 10);
		swp(1, 24);
		swp(4, 27);
		swp(7, 30);
		swp(16, 18);
	}
	{
		swp(15, 16);
		swp(1, 28);
		swp(2, 29);
		swp(3, 30);
		swp(19, 21);
		solve(times + 1);
		swp(15, 16);
		swp(1, 28);
		swp(2, 29);
		swp(3, 30);
		swp(19, 21);
	}
	{
		swp(12, 19);
		swp(3, 22);
		swp(6, 25);
		swp(9, 28);
		swp(13, 15);
		solve(times + 1);
		swp(12, 19);
		swp(3, 22);
		swp(6, 25);
		swp(9, 28);
		swp(13, 15);
	}
	return;
}

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++){
		ans = INF;
		for (int j = 1; j <= 30; j++){
			cin >> puzzle[j];
		}
		solve(0);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
# -*- coding:utf-8 -*-
"""解説
B以下の整数のうち、CでもDでも割り切れないものの個数をCountBとする
A以下の整数のうち、CでもDでも割り切れないものの個数をCountAとする

求める答えは、CountB - CountA

・CountBの求め方
B以下の整数のうち、Cで割り切れるものの個数はCountB_C = B//C
B以下の整数のうち、Dで割り切れるものの個数はCountB_D = B//D
B以下の整数のうち、CでもDでも割り切れるものの個数はCountB_CD = B//lcm(C,D)

CountB = B - (CountB_C + CountB_D - CountB_CD)

"""
from fractions import gcd

def solve():
    A, B, C, D = list(map(int, input().split()))
    def lcm(a, b):
        """ aとbの最小公倍数を返す """
        return a*b // gcd(a, b)

    def f(x):
        """ 1以上x以下の整数のうち、CでもDでも割り切れないものの個数を返す """
        return x - (x//C + x//D - x//lcm(C,D))    

    ans = f(B) - f(A-1)

    print(ans)


if __name__ == "__main__":
    solve()


Measured memory_bytes: 5240
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int n;
    cin>>n;
    vll a(n);
    cin >> a;
    ll xorsum = a[0];
    FOR(i, 1, n) { xorsum ^= a[i]; }
    vll ans(n);
    REP(i, n) { ans[i] = xorsum ^ a[i]; }
    cout << ans;
}

Measured memory_bytes: 6224
X,Y,A,B,C = map(int, input().split())
p = [int(x) for x in input().split()]
q = [int(x) for x in input().split()]
r = [int(x) for x in input().split()]
p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
newp = p[:X]
newq = q[:Y]
lis = newp + newq
lis.sort(reverse = True)
s = sum(lis)
for i in range(len(r)):
    if lis[-i-1] < r[i]:
        s = s - lis[-i-1] + r[i]
    else:
        break
print(s)


Measured memory_bytes: 23340
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int K=3005;
int x[K][K];
int n,k;
int getsize(int x1,int y1,int x2,int y2){
    return x[x2][y2]-x[x2][y1]-x[x1][y2]+x[x1][y1];
}
int main()
{
    scanf("%d%d",&n,&k);
    int a,b;
    char c;
    for(int i=1;i<=n;i++){
        scanf("%d%d %c",&a,&b,&c);
        a%=2*k,b%=2*k;
        if(c=='W')
            b+=k;
        x[a%(2*k)+1][b%(2*k)+1]++;
    }
    for(int i=1;i<=2*k;i++)
        for(int j=1;j<=2*k;j++)
            x[i][j]=x[i][j]+(x[i-1][j]+x[i][j-1]-x[i-1][j-1]);
    int ans=0,sum;
    for(int i=1;i<=k;i++)
        for(int j=1;j<=k;j++){
            sum=getsize(0,0,i,j);
            sum+=getsize(i,j,k+i,k+j);
            sum+=getsize(k+i,k+j,2*k,2*k);
            sum+=getsize(k+i,0,2*k,j);
            sum+=getsize(0,k+j,i,2*k);
            sum=max(n-sum,sum);
            ans=max(ans,sum);
        }
    printf("%d\n",ans);
}

Measured memory_bytes: 24704
#include <iostream>
#include <string>
 
using namespace std;
 
int main(void) {
	int N, a[100000], t[100000] = { 0 }, ans, tmp;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		t[a[i]]++;
	}
 
	ans = t[0] + t[1];
	for (int i = 1; i < N - 1; i++) {
		tmp = t[i - 1] + t[i] + t[i + 1];
		if (ans < tmp)	ans = tmp;
	}
	tmp = t[N - 2] + t[N - 1];
	if (ans < tmp)	ans = tmp;
	if (N == 1)	ans = 1;
 
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>

int main(){
    char i;
    scanf("%c" ,&i);

    if(i=='A'){
        printf("T\n");
    }
    else if(i=='T'){
        printf("A\n");
    }
    else if(i=='C'){
        printf("G\n");
    }
    else{
        printf("C\n");
    }
    return 0;  
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const string ALPHABET = "abcdefghijklmnopqrstuvwxyz";
// 文字列 T の 先頭から, 順に, 文字列 S を 1グーゴル個連結した文字列(以下, S'と略記)中に, 出現する位置 を 保存.
LL dp[111111];
// 文字列 S の 各文字 の 出現位置 を 保管.
vector<vector<LL>> sPos(26);

int main(){
    
    // 1. 入力情報取得.
    char S[111111], T[111111];
    scanf("%s %s", S, T);
    int sl = strlen(S);
    int tl = strlen(T);
    
    // 2. 各文字の出現回数を保存.
    map<char, int> ms, mt;
    for(int i = 0; i < ALPHABET.size(); i++) ms[ALPHABET[i]] = 0, mt[ALPHABET[i]] = 0;
    for(int i = 0; i < sl; i++){
        ms[S[i]]++;
        int index = S[i] - 'a';
        sPos[index].push_back(i + 1);
    }
    for(int i = 0; i < tl; i++) mt[T[i]]++;
    // for(int i = 0; i < 26; i++){
    //     for(auto &p : sPos[i]) printf("%lld ", p);
    //     printf("\n");
    // }
    
    // 3. 存在しないケースを出力.
    // 文字列 S に 存在しない文字が, 文字列 T に 含まれている場合.
    for(auto &p : mt){
        char c = p.first;
        if(ms[c] == 0 && mt[c] > 0){
            printf("%d\n", -1);
            return 0;
        }
    }
    
    // 4. dp更新.
    // ex.
    // S = contest
    // T = sentence
    // -> 以下のように考える.
    // 文字列 T の 各文字 について, 文字列 S で, 何番目 を 使っているか見る.
    // s: 6
    // e: 5 -> 12
    // n: 3 -> 10 -> 17
    // t: 4 ->  7 -> 11 -> 14 -> 18
    // e: 5 -> 12 -> 19
    // n: 3 -> 10 -> 17 -> 24
    // c: 1 ->  8 -> 15 -> 22 -> 29
    // e: 5 -> 12 -> 19 -> 26 -> 33
    // -> 上記から, 33文字 と 判明.
    LL bef = 0; // 前回出現位置.
    for(int i = 0; i < tl; i++){
        // 今回チェックする文字列 T 中 の 文字 c.
        char c = T[i];
        int index = c - 'a';
        
        // 文字列 S 中 の 文字 c に関する出現位置情報 … sPos[index].
        // 今回出現位置 は 前回出現位置 から 逆算.
        LL tmp = lower_bound(sPos[index].begin(), sPos[index].end(), (bef % sl + 1)) - sPos[index].begin();
        LL cPos = 0;
        if(tmp == sPos[index].size()) cPos = (bef / sl + 1) * sl + sPos[index][0]; // 末尾なら, 次のサイクルの最初の要素を設定.
        else                cPos = (bef / sl) * sl     + sPos[index][tmp];
        
        // 上記までで計算した位置を元に, dp を 更新.
        dp[i] = cPos;
        
        // 前回情報更新.
        bef = cPos;
    }
    
    // 5. 出力 ～ 後処理.
    // for(int i = 0; i < tl; i++) printf("%lld ", dp[i]);
    // printf("\n");
    printf("%lld\n", dp[tl - 1]);
    return 0;
    
}

Measured memory_bytes: 2336
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++) 
#define rep(i,n); for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b); 
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  string s;
  cin>>s;
  if(s=="AAA"||s=="BBB"){
    s="No";
  }else{
    s="Yes";
  }

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

Measured memory_bytes: 256
//https://atcoder.jp/contests/abc115/tasks/abc115_d
#include <bits/stdc++.h>
using namespace std;
using ll=int64_t;
#define FOR(i,a,b) for(int64_t i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
int main() {
    ll N,X;
#if LOCAL&01
    N=2;X=10;
#else
    cin>>N>>X;    
#endif
    vector<ll> ttl(N+1,0), ptn(N+1,0);
    ttl.at(0)=1;
    ptn.at(0)=1;
    FOR(i,1,N+1){
        ttl.at(i) = ttl.at(i-1)*2+3;
        ptn.at(i) = ptn.at(i-1)*2+1;
    }

    function<ll(ll,ll)> calc = [&](ll lv,ll x)->ll {
        ll nelv = lv-1;
        if(lv==0&&x==1) { return 1; } ;
        if(x<=1) return 0;
        else if(x<=1+ttl.at(nelv)) return calc(nelv,x-1);
        else if(x<=2+ttl.at(nelv)*2) return calc(nelv,x-ttl.at(nelv)-2)+ptn.at(nelv)+1LL;
        else return ptn.at(nelv)*2+1LL;
        assert(0);
        return 0;
    };
    ll ans = calc(N,X);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#EDP-D, E
import sys
from collections import defaultdict
n, W = map(int, sys.stdin.readline().split())
dp = [defaultdict(int) for _ in range(n)]
#初期設定
w, v = map(int, sys.stdin.readline().split())
dp[0][w] = v
#print(dp)

for i in range(1, n):
    w, v = map(int, sys.stdin.readline().split())
    dp[i][w] = max(dp[i-1].get(w, 0), v)
    for w1, v1 in dp[i-1].items():
        dp[i][w1] = max(dp[i][w1], v1)
        if w+w1<=W:
            dp[i][w1+w] = max(dp[i][w1+w], v1+v)

print(max(dp[-1].values()))

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

int main(){
    int h,w,i;
    bool b=true;
    string ans="",temp1="",temp2="";
    while(1){
      cin>>h>>w;
      if (h==0&&w==0)break;
      else{
        for (i=0;i<w;i++){
          if (b)temp1+="#";
          else temp1+=".";
          b=!b;
        }
        b=false;
        for (i=0;i<w;i++){
          if (b)temp2+="#";
          else temp2+=".";
          b=!b;
        }
        b=true;
        for (i=0;i<h;i++){
          if (b)ans+=temp1+"\n";
          else ans+=temp2+"\n";
          b=!b;
        }
        cout << ans << endl;
        ans="";temp1="";temp2="";b=true;

    }}
    return 0;
}




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

#define   ipr         	pair<int, int>
#define   pb            push_back
#define   ff            first
#define   ss            second
#define   fr(i, j, k)   for (int i = j; i < k; i++)
#define   rf(i, j, k)   for (int i = j; i >= k;i--)
#define   int           long long
#define   ll 			unsigned long long
#define   ld            long double
#define   all(x)        x.begin(), x.end()
#define   rall(x)       x.rbegin(),x.rend()
#define   mp            make_pair
#define   inf           INT_MAX
#define   read_file();	freopen("input.txt", "r", stdin);	freopen("output.txt", "w", stdout);
#define   IOS           std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

const int Maxn  =  10000;
const ld  pi   =  acos(-1);
const int mod =  1000000007;


template<class T> ostream& operator <<(ostream &out,vector<T> &A){for(auto x:A) out<<x<<" ";return out;}
template<class T> ostream& operator <<(ostream &out,set<T> &A){for(auto x:A) out<<x<<" ";return out;}
template <class T1,class T2>T1 powr(T1 a,T2 b){T1 res = 1;fr(i,1,b+1)res = res*a;return res;}


int32_t main(){IOS
  
  int N,A,B,ans,rem;
    cin>>N>>A>>B;
    ans = (N/ (A + B) )* A;
      rem = N % (A + B);
       ans += min(rem, A);
       cout<<(ans);

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define rmin(r, x) r = min(r, x);
#define rmax(r, x) r = max(r, x);
#define ends ' '
#define endl '\n'
#define fastio ios_base::sync_with_stdio(0), cin.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int mod = 1e9 + 7;

int main(void) {
    fastio;
    int n;  cin >> n;
    ll ans = 0, sum = 0;
    for(int i = 1; i <= n; ++i) {
        ll x;   cin >> x;
        ans += sum * x;
        sum += x;
        ans %= mod;
        sum %= mod;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3632
//const int N = 1005, K = 5001;
//vi adj[N];
//int x[N],dp[N];
//void dfs(int u){
//    int must_take = 0, total = 0;
//    bitset<K> can_make;
//    can_make[0] = 1;
//    for(int v : adj[u]){
//        dfs(v);
//        int a = dp[v], b = x[v];
//        if(a > b)
//            swap(a,b);
//        must_take += a;
//        can_make |= can_make<<(b-a);
//        total += b-a;
//    }
//    int best = -1;
//    rep(i,0,x[u]-must_take)
//        if(can_make[i])
//            best = i;
//    if(best == -1){
//        print "IMPOSSIBLE";
//        exit(0);
//    }
//    dp[u] = total-best;
//}
//void __(){
//    _(int,n);
//    assert(1 <= n && n <= 1000);
//    rep(i,2,n){
//        _(int,p);
//        adj[p].pb(i);
//    }
//    rep(i,1,n){
//        cin >> x[i];
//        assert(0 <= x[i] && x[i] < K);
//    }
//    dfs(1);
//    print "POSSIBLE";
//}
//
#include <bitset>
#include <iomanip>
#include <cassert>
#include <vector>
#include <utility>
#include <iostream>
#include <string>
#define pb push_back
#define REP_INT(i,l,r) for(int i = l; i <= r; ++i)
#define GET_REP_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define rep(...) GET_REP_MACRO(__VA_ARGS__,REP_ANY,REP_INT,REP_ZERO_INT)(__VA_ARGS__)
#define all(v) (v).begin(), (v).end()
#define sz(v) ll(v.size())
#define T1 template<typename T> static
using namespace std;
typedef long long ll;
typedef vector<int> vi;
T1 ostream& operator<<(ostream& stream, const vector<T>& t);
T1 istream& read(T, T, istream& = cin);
struct _print {
    string sep,end;
    bool space;
    ostream &stream;
    _print(string _sep=" ",string _end="\n",
            ostream &_stream = cout)
        : sep(_sep),end(_end),space(false),
            stream(_stream) {}
    ~_print() { stream << end; }
    template <typename T>
        _print &operator , (const T &t) {
            if (space) stream << sep;
            space = true;
            stream << t;
            return *this;
        }
};
#define print _print(),
#define INPUT_WITHOUT_INIT(type,name) type name; cin >> name
#define GET_INPUT_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define _(...) GET_INPUT_MACRO(__VA_ARGS__,_IWI,_IWI,_IWI,_IWI,_IWI,_IWI,INPUT_WITHOUT_INIT)(__VA_ARGS__)
const int N = 1005, K = 5001;
vi adj[N];
int x[N],dp[N];
void dfs(int u){
    int must_take = 0, total = 0;
    bitset<K> can_make;
    can_make[0] = 1;
    for(int v : adj[u]){
        dfs(v);
        int a = dp[v], b = x[v];
        if(a > b)
            swap(a,b);
        must_take += a;
        can_make |= can_make<<(b-a);
        total += b-a;
    }
    int best = -1;
    rep(i,0,x[u]-must_take)
        if(can_make[i])
            best = i;
    if(best == -1){
        print "IMPOSSIBLE";
        exit(0);
    }
    dp[u] = total-best;
}
void __(){
    _(int,n);
    assert(1 <= n && n <= 1000);
    rep(i,2,n){
        _(int,p);
        adj[p].pb(i);
    }
    rep(i,1,n){
        cin >> x[i];
        assert(0 <= x[i] && x[i] < K);
    }
    dfs(1);
    print "POSSIBLE";
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
        __();
}


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

using namespace std;

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

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


int main()
{
    int m, min, max;
    while (cin >> m >> min >> max, m) {
        vector<int> data(200, 0);
        rep(i, m) {
            cin >> data[i];
        }
        int ans = 0;
        int ret = min;
        for (int i = min; i <= max; i++) {
            if (ans <= data[i-1] - data[i]) {
                ans = data[i-1] - data[i];
                ret = i;
            }
        }
        cout << ret << endl;
    }
    return 0;
}

Measured memory_bytes: 3112
long d['~~'];A,x,i,j;main(n){for(scanf("%d%d",&n,&A),d[n*=A]=1;~scanf("%d",&x);i=5e3-i)for(x-=A,j=2*n+1;j--;)d[5000-i+j]=d[i+j]+(j<x|j-x>2*n?0:d[i+j-x]);printf("%ld",d[i+n]-1);}

Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll L;
    cin >> L;

    cout << L * L * L / (long double)(27) << endl;
    
}


Measured memory_bytes: 256
#if DEBUG
using Console = AtCoder.Console;
#endif
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
#if DEBUG
            Console.Arg =
@"10010010
";
#endif
            var tiles = Console.ReadLine();
            int ans1 = 0;
            int ans2 = 0;
            for(int i = 0; i < tiles.Length; i++) {
                if(i % 2 == 0) {
                    ans1 = tiles[i] == '0' ? ans1 : ans1 + 1;
                }
                else {
                    ans1 = tiles[i] == '1' ? ans1 : ans1 + 1;
                }
                
            }
            for(int i = 0; i < tiles.Length; i++) {
                if(i % 2 == 0) {
                    ans2 = tiles[i] == '1' ? ans2 : ans2 + 1;
                }
                else {
                    ans2 = tiles[i] == '0' ? ans2 : ans2 + 1;
                }

            }
            Console.WriteLine(Math.Min(ans1, ans2));
#if DEBUG
            Console.Wait();
#endif

        }
    }

    public static class StringExtension
    {
        public static int ToInt(this string str) => int.Parse(str);

        public static long ToLong(this string str) => long.Parse(str);

        public static short ToShort(this string str) => short.Parse(str);
    }
}


Measured memory_bytes: 13116
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);

    constexpr int MX = int(1e5 + 5);

    var(int, N, M);
    vector<int> cnt(MX);
    vector<int> cntmod(M);
    vector<int> cntp(M);

    rep(i, 0, N) {
        var(int, x);
        ++cnt[x];
        ++cntmod[x % M];
    }

    rep(i, 1, MX) {
        cntp[i % M] += cnt[i] / 2;
    }

    int ans = 0;
    for (int i = 0; i <= M / 2; ++i) {
        if ((i + i) % M == 0) {
            ans += cntmod[i] / 2;
        } else {
            int x = i;
            int y = M - i;
            if (cntmod[x] < cntmod[y]) swap(x, y);

            const int rem = cntmod[x] - cntmod[y];
            ans += min(rem / 2, cntp[x]);
            ans += cntmod[y];
        }
    }

    print(ans);

    return 0;
}


Measured memory_bytes: 1408
s = input()
x = ''.join(list(reversed(s)))
n = len(s)
ans = 'No'
if s==x:
    a = s[:(n-1)//2]
    x = ''.join(list(reversed(a)))
    if a==x:
        b = s[(n+3)//2-1:]
        x = ''.join(list(reversed(b)))
        if b==x:
            ans = 'Yes'
print(ans)


Measured memory_bytes: 38384
h,w = map(int,input().split())
ans = 0

if h%2 == 0 and w%2 == 0:
  ans = (h//2)*w

if h%2 == 0 and w%2 == 1:
  ans = (h//2)*w

if h%2 == 1 and w%2 == 0:
  ans = h*(w//2)

if h%2 == 1 and w%2 == 1:
  ans = (h*w)//2+1
#

if h == 1 or w ==1:
  ans = 1

print(ans)


Measured memory_bytes: 3060
#include <stdio.h>

int main(void){
    int coor[5];
    int lim;
    int i,j;
    int flag = 1;
    
    for(i = 0; i < 5; i++){
        scanf("%d", &coor[i]);
    }
    
    scanf("%d", &lim);
    
    for(i = 0; i < 5; i++){
        for(j = i+1; j < 5; j++){
            if(coor[j] - coor[i] > lim){
                flag = 0;
                break;
            }
        }
    }
    
    
    if(flag){
        puts("Yay!");
    }else{
        puts(":(");
    }
    
    return 0;
}

Measured memory_bytes: 128
N = int(input())
P = list(map(float, input().split()))

dp = [[0 for _ in range(N+1)] for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for head in range(N):
        dp[i+1][head+1] += dp[i][head] * P[i]
        dp[i+1][head] += dp[i][head] * (1-P[i])

print(sum(dp[-1][(N+1)//2:]))


Measured memory_bytes: 257800
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
//#define int long long

template <class T>
bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template <class T>
bool chmax(T &a, const T &b) {if (a < b){ a = b; return 1;} return 0;}
template <class T>
bool chmin(T &a, const T &b) {if (a > b){ a = b; return 1;}return 0;}
template <class T>
void printv(vector<T> v) {for (T t : v) {cout << t << " ";}cout << '\n';}

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define RFOR(i, a, b) for (int i = (a); i >= (b); --i)
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef pair<int, int> pii;

ll _gcd(ll a, ll b){
	if (a%b==0) return b;
	else return _gcd(b,a%b);
}

ll _lcm(ll a, ll b){
    return a/_gcd(a,b)*b;
}

ll f(ll x, ll d, ll c) {
    return x - x/c - x/d + x/_lcm(c,d);
}

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

    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << f(B, D, C) - f(A-1, D, C) << endl;

    return 0;
}


Measured memory_bytes: 256
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

//#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve() {
	int l, r, d; cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; ++ i) {
        if(i % d == 0) ++ ans;
    }
    cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

Measured memory_bytes: 3564
n,d=map(int,input().split())
x=[]
for i in range(n):
	p=list(map(int,input().split()))
	x.append(p)
heihoukon=[]
for i in range(200):
	heihoukon.append(i**2)
ans=0
for a in range(n):
	for b in range(n):
		cnt=0
		for c in range(d):
			cnt+=(x[a-1][c]-x[b-1][c])**2
		if cnt in heihoukon and a!=b:
			ans+=1
print(ans//2)



Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define rint register int
#define rep(i,a,b) for (rint i=(a),_E=(b); i<=_E; ++i)
#define per(i,a,b) for (rint i=(a),_E=(b); i>=_E; --i)
#define REP(i,n) for (rint i=(0),_E=(n); i<_E; ++i)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

const int k = 37;
const int n = k * (k + 1) + 1;
int a[k+5][n+5], num[k+5][k+5];
int x[k+5][k+5], cnt;

int main() {
	printf("%d %d\n", n, k + 1);
	rep (i, 1, k + 1) a[i][1] = i;
	rep (i, 2, n) a[1][i] = (i + k - 2) / k;
	cnt = k + 1;
	rep (j, 1, k) rep (i, 1, k)
		a[i+1][j+1] = x[i][j] = ++ cnt;
	rep (t, 1, k) {
		rep (i, 1, k) rep (j, 1, k)
			a[i+1][t*k+1+j] = x[(j+i*t)%k+1][i];
	}
	/*
	rep (i, 1, k + 1) {
		rep (j, 1, n) printf("%d ", a[i][j]);
		puts("");
	}
	*/
	rep (j, 1, n) {
		rep (i, 1, k + 1) printf("%d ", a[i][j]);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    int a;
    int sum=0;

    scanf("%d",&n);
    while(n--)
    {
        scanf("%d",&a);
        if(a%2) sum++;
    }
    if(sum%2 == 0) printf("YES\n");
    else printf("NO\n");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<Pll> v;
    map<ll,ll> mp;
    rep(i,N){
        cin >> A[i];
        mp[A[i]]++;
    }
    sort(A.begin(), A.end(), greater<ll>());
    for(auto& e:mp){
        v.push_back(e);
    }
    ll tmp = 0;
    bool flag = false;
    for(int i = v.size() -1 ;i>=0;i--){
        if(v[i].second >= 4){
            if(!flag){
                cout << v[i].first*v[i].first << endl;
                return 0;
            }else{
                cout << tmp*v[i].first << endl;
                return 0;
            }
        }else if(v[i].second >= 2){
            if(flag){
                cout << tmp*v[i].first << endl;
                return 0;
            }
            flag = true;
            tmp = v[i].first;
        }
    }
    cout << 0 << endl;
}


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

using namespace std;
typedef long long ll;
int n;
ll a[200005], sm[200005];
map<ll, ll> mp;
ll ans = 0;
int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i ++){
		scanf("%lld", &a[i]);
		sm[i] = sm[i - 1] + a[i]; 
	}
	mp[0] = 1;
	for(int i = 1; i <= n; i ++){
		if(mp.count(sm[i])) ans += mp[sm[i]];
		mp[sm[i]] ++;
	}
	printf("%lld\n", ans);
	return 0;
} 

Measured memory_bytes: 15872
#include<iostream>

using namespace std;

int main(){
  int n[101],x[301],count,s=1;
  while(s>=0){
    cin>>n[s]>>x[s];
    if(n[s]==0&&x[s]==0)break;
    s++;
  }
  for(int i=1;i<s;i++){
    count=0;
    for(int a=1;a<=n[i];a++){
      for(int b=1;b<=n[i];b++){
        for(int c=1;c<=n[i];c++){
          if(a<b&&b<c&&a+b+c==x[i])count++;
        }
      }
    }
    cout<<count<<endl;
  }
  return 0;
}



Measured memory_bytes: 3088
#include <iostream>
#include <string>
typedef long long ll;
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    ll cnt=0;
    for(int i=a; i<=b; i++) {
        string s = to_string(i);
        int j=0;
        bool flag=true;
        while(j<=s.length()/2) {
            if(s[j]!=s[s.length()-1-j]) {
                flag=false;
                break;
            }
            j++;
        }
        if(flag) cnt++;
    }
    cout << cnt << endl;
    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++)
#define RNG(i,from,to) for(int i=(from); i<(int)(to); i++)
#define gcd(i,j) __gcd((i), (j))
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vecll;
template<typename S, typename T> string to_string(pair<S, T> p) { return "("+to_string(p.first)+","+to_string(p.second)+")"; }
template<typename T> string to_string(T p[2]) { return "["+to_string(p[0])+","+to_string(p[1])+"]"; }
template<typename T> void println(T e){ cout << to_string(e) << endl; }
template<typename T> void println(const vector<T>& v){ cout << "[";for(const auto& e : v){ cout << to_string(e) << ","; }cout << "]";cout << endl; }
template<typename T> void println(const vector<vector<T>>& vv){ for(const auto& v : vv){ println(v); } }
template<typename Iter> void println(Iter first, Iter last){ for(auto it=first; it != last; it++){ cout << *it << " "; }; cout << endl; }
template<typename T> T mod_pow(T x, T n, const T &p) { T ret = 1; while(n > 0) { if(n & 1) (ret *= x) %= p; (x *= x) %= p; n >>= 1; } return ret; }
template<typename T> T mod_inv(T x, const T &p) { return mod_pow(x, p-2, p); }
const ll DVSR = 1e9+7;



int main(int argc, char const *argv[])
{
  ll H,W,K; cin >> H >> W >> K;
  vector<int> MP(1000);
  string line;
  vector<int> ACC(H);
  vector<int> CURR(H);

  REP(i, 1000) MP[i] = 0;
  REP(j, H) {
    cin >> line;
    REP(i, W) {
      if (line[i] == '1') {
        MP[i] |= (1 << j);
      }
    }
  }

  int res = H*W;
  REP(k, 1 << (H-1)) {
    int cnt_brr = 0;
    REP(i, H) {
      ACC[i] = 0;
      CURR[i] = 0;
    }
    REP(i, 10) cnt_brr += (k >> i) & 1;
    // cout << "init cnt_brr: " << cnt_brr << "bit: " << bitset<16>(k) << endl;
    REP(j, W) {
      REP(i, H) CURR[i] = 0;
      int part = 0, i = 0, bound = 1;
      bool isBarrier = false;
      while (bound <= H) {
        while (!(k & (1 << (bound-1))) && bound < H) bound++;
        while (i < bound) {
          // cout << MP[j] << endl;
          CURR[part] += 1 & (MP[j] >> i);
          i++;
        }
        isBarrier = isBarrier || CURR[part]+ACC[part] > K;
        part++;
        bound++;
      }
      REP(i, H) if (CURR[i] > K) {
        cnt_brr = H*W;
        // cout << "break" << endl;
        break;
      }
      if (isBarrier) {
        REP(i, H) {
          // cout << ACC[i] << " ";
          ACC[i] = CURR[i];
        }
        // cout << endl;
        cnt_brr++;
        // cout << "add brr: " << j << endl;
      } else {
        REP(i, H) ACC[i] += CURR[i];
      }
    }
    // cout << "cnt_brr: " << cnt_brr << endl;
    res = min(res, cnt_brr);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#include <bits/stdc++.h>
 
using namespace std;
 
int main(void) {
    ll n, ans = 1;
    cin >> n;
    string s[n];
    rep(i, n){
        cin >> s[i];
    }
    sort(s, s+n);
    rep2(i, 1, n-1){
        if(s[i] != s[i-1]){
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9856
#include <cstdio>
#include <set>
using namespace std;

int main() {
  int n;
  scanf("%d\n", &n);
  set<int> nums;
  bool rlt = true;
  for (int i = 0; i < n; i++) {
    int num;
    scanf("%d", &num);
    if (nums.count(num)) {
      rlt = false;
      break;
    }
    nums.insert(num);
  }
  if (rlt) {
    printf("YES\n");
  } else {
    printf("NO\n");
  }
}


Measured memory_bytes: 9600
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> p;
const int inf=100000000;
#define rep(i,a,n)	for(int i=a;i<n;i++)
#define rrep(i,a,n) for(int i=(a-1);i>=n;i--)
int main(){
	int n,i;
	cin>>n>>i;
	cout<<n-i+1<<endl;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

struct num{
	int a;
	int b;

	bool operator<(const num &in) const{
		return a!=in.a ? a<in.a : b<in.b;
	};
};

int main(){

	int n, q, p, x, pos=1;
	vector<int> v, ans;
	vector<num> w;

	cin>> n >> q;

	w.resize(n);
	v.resize(n+1);
	ans.resize(n+1);

	for(int i=0;i<n-1;i++){
		cin>> w[i].a >> w[i].b;
		v[i]=0;
	}

	for(int i=0;i<q;i++){
		cin>> p >> x;
		v[p]+=x;
	}

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

	for(int i=1;i<n;i++){
		//cout<< w[i].a <<" "<< w[i].b <<endl;
		v[w[i].b]+=v[w[i].a];
	}

	for(int i=1;i<n;i++) cout<< v[i] << " ";
	cout<< v[n] <<endl;

}

Measured memory_bytes: 5504
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1000000007;
const double PI = acos(-1);

const int amax = 1e6;

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

	vector<int> cnt(amax + 1);
	for (int i = 0; i < n; i++) {
		if (cnt[a[i]] == 0) {
			for (int j = a[i]; j < cnt.size(); j += a[i]) cnt[j] = 1;
		}
		else if (cnt[a[i]] == 1) cnt[a[i]] = 2;
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (cnt[a[i]] == 1) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 7936
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int n, a;
    cin >> n >> a;
    if(n >= 500) n %= 500;
    if(n <= a) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var str = ReadLine();
        for(var j=2;j<4;j++)
            for(var i = 0; i < str.Length - j + 1; i++)
            {
                var s = str.Substring(i, j);
                if (j == 2 && s[0] == s[1])
                {
                    WriteLine($"{i + 1} {i + j}");
                    return;
                }
                if (j == 3 && s[0] == s[2])
                {
                    WriteLine($"{i + 1} {i + j}");
                    return;
                }
            }
        WriteLine("-1 -1");
    }
}


Measured memory_bytes: 15328