akhauriyash/Code-Regression huggingface dataset:
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define yes(n) cout << ((n) ? "yes" : "no"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;
#define FIX cout << fixed << setprecision(15)

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define VVi vector<vector<ll>>
#define Vd vector<double>
#define Vb vector<bool>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

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

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN(s);
  if(s.size()==3){
    REV(s);
    OUT(s);
  } else OUT(s);
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int n,t;
    scanf("%d%d",&n,&t);
    int a[n],b[n];
    for(int i=0;i<n;i++){
        scanf("%d%d",&a[i],&b[i]);
    }
    int x=10000;
    for(int i=0;i<n;i++){
        if(b[i]<=t){
            if(a[i]<x)x=a[i];
        }
    }
    if(x==10000)printf("TLE\n");
    else printf("%d\n",x);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int a,b,c,n;
int main() {
    int count=0;
   cin>>a>>b>>c>>n;
   for(int i=0;i<a+1;i++){
       for(int j=0;j<b+1;j++){
           for(int k=0;k<c+1;k++){
               if(500*i+100*j+50*k==n) count++;
           }
       }
   }

    cout<<count<<endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
	for(auto &e:u) fill_v<T>(e,v...);
}

int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int64 N, K;
	cin >> N >> K;
	vector<int64> H(N);
	REP(i, N) cin >> H[i];
	sort(all(H), greater<int64>());
	int64 sum = accumulate(all(H), 0LL);
	REP(i, min(K, N)) {
	  sum -= H[i];
	}
	cout << sum << endl;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main() {
	int A, B, C, min, max = 0;
	if (scanf("%d %d %d", &A, &B, &C) == -1) return -1;
	if (B >= C) max = B + C;
	else if (A >= C - B) max = B + C;
	else max = 2 * B + A + 1;
	printf("%d\n", max);
	return 0;
}

Measured memory_bytes: 128
import java.util.*;

public class Main{
  public static void main(String[] args){

    Scanner sc = new Scanner(System.in);
    
    long a = sc.nextLong();
    long b = sc.nextLong();
    long c = sc.nextLong();
    long d = sc.nextLong();
    
    long h = a*c;
    long i = a*d;
    long j = b*c;
    long k = b*d;
    
    long x = Math.max(h,i);
    long y = Math.max(j,k);
    long z = Math.max(x,y);
    
    System.out.println(z);
  }
}
    
    
    

Measured memory_bytes: 35664
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "yes"; }
  string_type do_falsename() const { return "no"; }
};

void solve(string S) {
  sort(ALL(S));
  const int n = S.size();
  bool flag = true;
  REP(i,n-1)
    if (S[i] == S[i+1]) flag = false;
  cout << flag << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	string S;
	cin >> S;
	solve(S);
	return 0;
}


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

int main () {
  int N, K;
  cin >> N >> K;
  
  int i = 1;
  int a = 1;
  while(2 * a < a + K && i <= N) {
    a *= 2;
    i++;
  }
  
  if(i - 1 < N) a += K *(N - i + 1);
  
  cout << a << endl;
}
    

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iostream>
#include <map>
#include <stack>
#include <queue>
#include <vector>

static const int IINF = 1 << 30;
static const long long LINF = 1LL << 60;
static const long long MOD = 1.0e+9 + 7;

template <typename T> std::vector<T> vectors(std::size_t n, T val) {
  return std::vector<T>(n, val);
}

template <typename T, typename... Args>
auto vectors(std::size_t n, Args... args) {
  return std::vector<decltype(vectors<T>(args...))>(n, vectors<T>(args...));
}

template <class T> inline bool chmin(T &a, const T &b) {
  return (a > b) ? a = b, true : false;
}

template <class T> inline bool chmax(T &a, const T &b) {
  return (a < b) ? a = b, true : false;
}

template <class T> inline void chadd(T &a, const T &b) {
  a += b, a %= MOD;
  // TODO minus case
}

template <class T>
std::ostream &operator<<(std::ostream &s, const std::vector<T> &v) {
  if (v.empty())
    return s;
  s << *v.begin();
  for (auto iter = v.begin() + 1; iter != v.end(); ++iter)
    if (std::is_fundamental<T>::value)
      s << " " << *iter;
    else
      s << std::endl << *iter;
  return s;
}

int main() {
  long long N, A, B;
  std::cin >> N >> A >> B;

  long long k = N / (A + B);
  long long r = N % (A + B);

  long long res = 0;
  res += k * A;
  if (r > A) {
    res += A;
  } else {
    res += r;
  }

  std::cout << res << std::endl;

  return 0;
}


Measured memory_bytes: 256
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  A=LI()

  g=0
  for x in A:
    g=math.gcd(g,x)
  if g>1:
    return 'not coprime'

  sosu=[0]*1000100
  for x in A:
    if x==1:
      continue
    sosu[x]+=1
    if sosu[x]>1:
      return 'setwise coprime'
    for y in range(2,int(math.sqrt(x))+1):
      if x%y!=0:
        continue
      z=x//y
      if y==z:
        sosu[y]+=1
        if sosu[y]>1:
          return 'setwise coprime'
      else:
        sosu[y]+=1
        if sosu[y]>1:
          return 'setwise coprime'
        sosu[z]+=1
        if sosu[z]>1:
          return 'setwise coprime'

  return 'pairwise coprime'

# main()
print(main())


Measured memory_bytes: 188972
x, y = [int(i) for i in input().split()]
a2 = 0
a4 = 0
flag =0

for k in range(x+1):
    a2 = 2*k
    a4 = 4*(x-k)
    y_t = a2 + a4
    
    if y_t == y:
        print('Yes')
        flag = 1

if flag == 0:
    print('No')

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

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


bool possible(ll a, ll b, string S, string T) {
    ll gcd = calc_gcd(a, b);
    int indexS = 0, indexT = 0;
    ll intervalS = a/gcd, intervalT = b/gcd;

    bool flag = true;
    while((indexS + intervalS)<=a && (indexT + intervalT)<=b) {
        if(S[indexS]!=T[indexT]) {
            flag = false;
            break;
        }
        indexS += intervalS;
        indexT += intervalT;
    }
    return flag;
}

ll solve(ll N, ll M, string S, string T) {
    ll lcm = -1;
    if(possible(N, M, S, T)) {
        lcm = (N*M)/calc_gcd(N, M);
    }
    return lcm;
}

int main() {
    ll N, M;
    string S, T;

    cin >> N >> M >> S >> T;

    cout << solve(N, M, S, T) << endl;
}

Measured memory_bytes: 3412
import itertools
H,W,K = [int(i) for i in input().split()]

M = []
for i in range(H):
    M.append(input())

h_list = list(range(H))
w_list = list(range(W))

h_result=[]
for n in range(1,len(h_list)+1):
    for conb in itertools.combinations(h_list, n):
        h_result.append(list(conb)) #タプルをリスト型に変換
h_result.append([100])
#print(h_result)

w_result=[]
for n in range(1,len(w_list)+1):
    for conb in itertools.combinations(w_list, n):
        w_result.append(list(conb)) #タプルをリスト型に変換
w_result.append([100])
#print(w_result)

ans = 0

for H_item in h_result:
    for W_item in w_result:

        tmp = 0
        for k in range(H):
            if k in H_item:
                continue
            for l in range(W):
                if l in W_item:
                    continue
                if M[k][l] == '#':
                    tmp += 1
        if K == tmp:
            ans += 1

print(ans)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll

int h, w, n, k, ans;

int pot[50*50];

int query(int y1, int y2, int x1, int x2)
{
	cout << "? " << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	int ans;
	cin >> ans;
	return ans;
}

void solve(int y1, int y2, int x1, int x2, int cnt, int split)
{
	if(cnt==0)
		return;

	if(cnt==(y2-y1+1)*(x2-x1+1))
	{
		for(int i = y1; i <= y2; ++i)
		{
			for(int j = x1; j <= x2; ++j)
			{
				ans += pot[i*w+j];
				ans %= k;
			}
		}

		return;
	}

	if(split)
	{
		int m = (y1+y2)/2;
		int h = query(y1, m, x1, x2);
		solve(y1, m, x1, x2, h, split^1);
		solve(m+1, y2, x1, x2, cnt-h, split^1);
	}
	else
	{
		int m = (x1+x2)/2;
		int h = query(y1, y2, x1, m);
		solve(y1, y2, x1, m, h, split^1);
		solve(y1, y2, m+1, x2, cnt-h, split^1);
	}
}

int32_t main()
{
	cin >> h >> w >> n >> k;

	pot[0] = 1;

	for(int i = 1; i < 50*50; ++i)
	{
		pot[i] = pot[i-1]*2%k;
	}

	for(int i = 0; i < h; i += 5)
	{
		for(int j = 0; j < w; j += 5)
		{
			solve(i, i+4, j, j+4, query(i, i+4, j, j+4), 1);
		}
	}

	//solve(0, h-1, 0, w-1, n, 1);

	cout << "! " << ans << endl;
}

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

int main() {
    string s;
    cin >> s;
    reverse(begin(s), end(s));
    vector<string> w { "dream", "dreamer", "erase", "eraser" };
    for (auto& e : w) reverse(begin(e), end(e));

    int pos = 0, ppos = -1;
    while (ppos != pos) {
        ppos = pos;
        for (auto& e : w) if (s.substr(pos, e.size()) == e) pos += e.size();
    }

    cout << (pos == (int) s.size() ? "YES" : "NO") << endl;
}


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

//入力
long long N;
// cur:　現在の値，　use: 7, 5, 3のうちどれを使ったか，　counter: 答え

void func(long long cur, int use, long long &counter)
{
  //ベースケース
  if (cur > N)
    return;
  //再帰ステップ
  if (use == 0b111)
    counter++;

  // 7 を付け加える
  func(cur * 10 + 7, use | 0b001, counter);

  // 5 を付け加える
  func(cur * 10 + 5, use | 0b010, counter);

  //3を付け加える
  func(cur * 10 + 3, use | 0b100, counter);
}

int main()
{
  cin >> N;
  long long res = 0;
  func(0, 0, res);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
from functools import lru_cache
import sys
mod=1000000007

n,k=[int(i) for i in input().split(" ")]

facts=[1 for i in range(n+k+1)]

for i in range(1,n+k+1):
    facts[i]=i*facts[i-1]

@lru_cache()
def combination(i,j):
    return facts[i]//(facts[j]*facts[i-j])

if n<k:
    print(0)
    sys.exit()



print(combination(n-1,k-1)%mod)



Measured memory_bytes: 8536
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, M, A;
priority_queue<int>pq;
ll res;

int main() {
	cin >> N >> M;
	while (N--) {
		cin >> A;
		pq.push(A);
	}
	while (M--) {
		pq.push(pq.top() / 2);
		pq.pop();
	}
	while (!pq.empty()) {
		res += pq.top();
		pq.pop();
	}
	cout << res << endl;
}

Measured memory_bytes: 892
"use strict";
const App4 = (arg: any) => {
  const Input = arg.trim().split("\n");
  const A: number = parseInt(Input[0].split(" ")[0], 10);
  const B: number = parseInt(Input[0].split(" ")[1], 10);
  const C: number = parseInt(Input[0].split(" ")[2], 10);

  const result = A + B + C;

  result >= 22 ? console.log('bust') : console.log('win');
};

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

Measured memory_bytes: 7372
#include <cstdio>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stack>
#include <algorithm>
#include <random>
#include <iomanip>
#include <unordered_map>
#include <map>
#include <queue>
#include <functional>
#include <numeric>
#include <chrono>
#include <cstdlib>
using ll = long long;
using namespace std;

const ll MOD = 1e9 + 7;
//const double EPS = 1e(-12);
const double pi = acos(-1);
typedef pair<int, int> P;
#define REP(i, n) for (int(i) = 0; (i) < (n); ++(i))
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define EPS 1e-4
#define OUTPUT(i) (cout << (ll)i << endl)
#define ALL(a) ((a).begin(), (a).end())

bool operator<(const pair<ll, ll> &a, const pair<ll, ll> &b)
{

    if (a.first == b.first)
        return a.second < b.second;

    return a.first < b.first;
}

ll arr[200010];

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

    ll N;
    cin >> N;
    for (int i = 0; i < N; ++i)
    {
        cin >> arr[i];
        if (i > 0)
            arr[i] += arr[i - 1];
    }

    ll ans = 10000000000;
    for (int i = 0; i < N - 1; ++i)
    {
        ans = min(ans, abs(arr[i] - (arr[N - 1] - arr[i])));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <string>
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string a;
    cin >> a;
    if(a.at(2)==a.at(3)){
        if(a.at(4)==a.at(5)){
            cout << "Yes" << endl;
        }else{
                cout << "No" << endl;

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


    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>

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

using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1e9;
const ll LINF = 1e18;

ll dp[105][100100];

int main() {
    int n;
    ll W;
    cin >> n >> W;
    
    vector<ll> w(n);
    vector<int> v(n);
    int MAXV = 0;
    rep(i,n) {
        cin >> w[i] >> v[i];
        MAXV += v[i];
    }
    rep(i,n+1) rep(j,MAXV+1) {
        dp[i][j] = LINF;
    }
    dp[0][0] = 0;
    rep(i,n+1) {
        rep(j, MAXV+1) {
            dp[i+1][j] = dp[i][j];
            if (j-v[i]>=0) dp[i+1][j] = min(dp[i+1][j], dp[i][j-v[i]] + w[i]);
        }              
    }
    int ans = 0;
    rep(i, n+1) {
        rep(j, MAXV+1) {
            //cout << "i: " << i << " j: " << j<< " dp: " << dp[i][j] << endl;
            if (dp[i][j]<=W) ans = max(ans, j);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 80128
#include <iostream>
#include<algorithm>
using namespace std;
#define MAX 10000000
bool prime[MAX]={true};

int countPrime(int n){
	if(n<2) return 0;
	if(n==2) return 1;
	int ret=0;
	// fill(data, data + numof(data), 0);
	fill(prime, prime+MAX,true);
	for(int i=2;i*i<=n;i++){
		if(prime[i]){
			for(int j=i*i;j<=n;j=j+i){
				prime[j]=false;
			}
		}
	}
	for(int i=2;i<=n;i++){
		if(prime[i]) ret++;
	}
	return ret;
}

int main(){
	int n;
	while(cin>>n){
		cout <<countPrime(n) <<endl;		
	}
	return 0;
}

Measured memory_bytes: 10928
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
template<typename T> inline T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }




int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int w, h, x, y;
    cin >> w >> h >> x >> y;
    cout << fixed << setprecision(10) << w / 2.0 * h << " ";
    if (2 * x == w && 2 * y == h) cout << 1 << endl;
    else cout << 0 << endl;
}



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

int main()
{
    string a,b;
    cin >> a >> b;
    if(a.size() > b.size()){
        cout << "GREATER" << endl;
    }else if(a.size() < b.size()){
        cout << "LESS" << endl;
    }else{
        if(a > b){
            cout << "GREATER" << endl;
        }else if(a < b){
            cout << "LESS" << endl;
        }else{
            cout << "EQUAL" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
class Task 
  def initialize(name, time)
    @name = name
    @time = time
  end
  attr_accessor :name, :time

  def process(quantum)
    if (@time > quantum) then
      @time -= quantum
      return quantum
    elsif
      a = @time
      @time = 0
      return a
    end
  end
end

n, q = gets.chomp.split(' ').map(&:to_i)
tasks = []
n.times do |i|
  array = gets.chomp.split(' ')
  tasks << Task.new(array[0], array[1].to_i)
end

proc_time_sum = 0
while (tasks.size > 0) do
  task = tasks.shift
  work_time = task.process(q)
  proc_time_sum += work_time

  if (task.time > 0) then
    tasks.push(task)
  else
    puts "#{task.name} #{proc_time_sum}"
  end
end

Measured memory_bytes: 13464
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> PP;

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

int main() {
    ios::sync_with_stdio(false);
    int N;
    map<int, int> H;
    cin >> N;
    for (int i = 0;i < N;i++) {
    	int n;
    	cin >> n;
    	H[n]++;
    }
    int sol = 0;
    for (auto it : H) {
    	int x = it.first;
    	int num = 0;
    	if (H.find(x - 1) != H.end()) num += H[x - 1];
    	num += H[x];
    	if (H.find(x + 1) != H.end()) num += H[x + 1];
    	sol = max(sol, num);
    }
    cout << sol << endl;
    return 0;
}

Measured memory_bytes: 3200
#include<stdio.h>
#include<stdlib.h>

int isPalin(int n){
  char str[8];
  sprintf(str,"%d",n);
  if(str[0]==str[4] && str[1]==str[3]) return 1;
  return 0;
}

int main(void){
  int A,B;
  int i,sum=0;
  scanf("%d%d",&A,&B);
  for(i=A;i<=B;i++) sum+=isPalin(i);
  printf("%d\n",sum);
  return 0;
}


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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var xyz = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var varX = xyz[0];
        var varY = xyz[1];
        var varZ = xyz[2];

        Console.WriteLine($"{varZ} {varX} {varY}");
    }
}


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

int main()
{
    int a, b;
    vector<int> x(3);
    rep(i, 3) x[i] = 1 + i;
    cin >> a;
    cin >> b;
    x.push_back(a);
    x.push_back(b);
    rep(i, 3) if (x[i] != a && x[i] != b) cout << x[i] << endl;
    return 0;
}

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

int main()
{
    string s, t;
    cin >> s >> t;
    int ans = 0;
    for(int i = 0; i < 3; i++) if(s[i] == t[i]) ans++;

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include<sstream>
#include<vector>
#include<iterator>
using namespace std;

int main(void)
{
	string s;
	cin >> s;

	int left = s.find("A");
	int right = s.rfind("Z");

	cout << right - left + 1 << endl;

	return 0;
}


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

void ioinit() { ios::sync_with_stdio(0); cin.tie(0); }

int main() {
  ioinit();
  int N, ans;
  string S;
  vector<int> black;
  cin >> N >> S;
  ans = N;
  black.push_back((S[0] == '#')? 1:0);
  for(int i = 1; i < N; i++){
  	black.push_back(black[i-1]);
    if(S[i] == '#') black[i]++;
  }
  for(int i = 0; i < N; i++){
    if(S[i] == '#'){
      ans = min(ans, 2*black[i]-black[N-1]+N-i-2);
    }
  }
  cout << min(ans, black[N-1]) << endl;
}

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

int main() {
	int N;
	cin>>N;
	vector<int> a(N);
	int ans = 0;
	rep(i,N)cin>>a[i];
	rep(i,N-1){
		if(a[i] == a[i+1]){
			ans++;
			a[i+1] = 0;
		}
	}
	cout<<ans<<endl;
}

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


int main(){
    string s;
    cin >> s;
    int ans10=0, ans01=0;
    
    string flg="mae";
    for(int i=0; i<s.size(); i++){
        if(flg=="mae"){
            if(s[i]=='0'){
                ans10++;
            }else if(s[i]=='1'){
                ans01++;
            }
            flg="usiro";
            continue;
        }
        
        if(flg=="usiro"){
            if(s[i]=='0'){
                ans01++;
            }else if(s[i]=='1'){
                ans10++;
            }
            flg="mae";
            continue;
        }
    }
    
    int min_ans=min(ans10, ans01);
    cout << min_ans << endl;
    
    //cout << s[1] << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<string>
#include <set>
#include <cassert>
#include<cmath>
using namespace std;
#define MOD 1000000007
class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

int find(vector<long long> &arr, long long obj) {
	if (arr[arr.size() - 1] < obj)return arr.size()-1;
	if (arr[0] > obj)return -1;

	int min = 0; int max = arr.size() - 1;
	for (int i = 0; i < arr.size(); i++) {
		if (arr[min+(max-min) / 2] > obj) {
			max = min + (max - min) / 2;
		}
		else {
			min = min + (max - min) / 2;
		}
		if (max - min == 1) {
			return min;
		}
	}


}


int main() {
	int n;
	cin >> n;
	int *a = new int[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > i) {
			cout << "-1";
			return 0;
		}
	}
	long long num = 0;
	long long prev = 0;
	for (int i = n - 1; i >= 0; i--) {
		if (a[i]>=prev) {
			num += a[i];
		}
		if (prev - a[i] >= 2) {
			cout << "-1";
			return 0;
		}
		prev = a[i];
	}
	cout << num;

	return 0;
}


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

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int val = (int)((float)i * 1.08);
    if (val == n) {
      cout << i << endl;
      return 0;
    } else if (val > n) {
      cout << ":(" << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
  // int val = (double)n / 1.08;
  // // cout << val << endl;
  // if ((int)(val * 1.08) == n) {
  //   cout << val << endl;
  // } else if ((int)(val * 1.08) + 1 == n) {
  //   cout << val + 1 << endl;
  // } else {
  //   cout << ":(" << endl;
  // }
  return 0;
}


Measured memory_bytes: 256
A,B,H,M = map(int,input().split())
import math
H_arg = 30*H + 0.5*M
M_arg = 6*M
arg = min(abs(H_arg - M_arg),abs(M_arg -H_arg),abs(360-(abs(H_arg - M_arg))),abs(360-(abs(M_arg - H_arg))))

ans = math.sqrt((A*A)+(B*B)-(2*A*B*math.cos(math.radians(arg))))
print(ans)

Measured memory_bytes: 62512
using System;using System.Linq;

class A {
	static void Main() {
		var n = int.Parse(Console.ReadLine());
		var m = Console.ReadLine().Split().Select(int.Parse).ToArray();
		var min = m.Min();
		var max = m.Max();
		var ans = int.MaxValue;
		if(min == max) {
			Console.WriteLine(0);
			return;
		}
		for(int i = min;i < max;i++) {
			var sum = 0;
			foreach(var j in m) sum += (j - i) * (j - i);
			if(sum < ans) ans = sum;
		}
		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 2904
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;

class Human
{
public:
	Human() {}
	
	vector<int> children;

private:

};

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

	vector<Human> h;
	h.resize(n);

	for (ull i = 1; i < n; i++)
	{
		ull in_n;
		cin >> in_n;
		h[in_n - 1].children.emplace_back(i + 1);
	}
	
	for (ull i = 0; i < n; i++)
	{
		cout << h[i].children.size()<<endl;
	}

	return 0;
}

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

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  int H, W;    // input

  int i, j;       // subscript
  int aft_H, aft_W;


  /* Input, Array_Proclamation */
  cin >> H >> W;
  aft_H = H +2;
  aft_W = W +2;

  vector< vector<char> > a(H, vector<char>(W));
  vector< vector<char> > enc(aft_H, vector<char>(aft_W, '#') ); // output

  for(i=0; i<H; i++)
  {
    for(j=0; j<W; j++)
    {
      cin >> a.at(i).at(j);
    }
  }

  /* Initialize */


  /* Calculation */
  for(i = 1; i < aft_H -1; i++)
  {
    for(j = 1; j < aft_W -1; j++)
    {
      enc.at(i).at(j) = a.at(i-1).at(j-1);
    }
  }


  /* Output */
  for(i=0; i<aft_H; i++)
  {
    for(j=0; j<aft_W; j++)
    {
      
      cout << enc.at(i).at(j);

      if(j == aft_W-1)
      {
        cout << endl;
      }

    }
  }
  
  


  return 0;

}


Measured memory_bytes: 256
nums = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(nums[int(input()) - 1])


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

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


int main()
{
    long int a,b;
    scanf("%ld %ld",&a,&b);
    int sa=b-a;
    long int sum=0;
    REP(i,sa)sum+=i+1;
    printf("%ld\n",sum-b);
    return 0;
}

Measured memory_bytes: 256
import copy
import math
import string

S = input()
Q = int(input())

is_reverse = False
front = ""
back = ""
for i in range(Q):
    A = list(map(str,input().split()))
    A[0] = int(A[0])
    if A[0] == 1:
        is_reverse = (not is_reverse)
    elif A[0] == 2:
        A[1] = int(A[1])
        if A[1] == 1:
            if is_reverse:
                back += A[2]
            else:
                front += A[2]
        else:
            if is_reverse:
                front += A[2]
            else:
                back += A[2]
front = front[::-1]
S = front + S + back
if is_reverse:
    S = S[::-1]
print(S)


Measured memory_bytes: 5096
#include<stdio.h>
int main(void){
	int a,b,c,d,e,f,g,h,i,j,tmp,k;
	scanf("%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d",&a,&b,&c,&d,&e,&f,&g,&h,&i,&j);
	for(k=0;k<=10;k++){
		if(a>b){
			tmp=a;
			a=b;
			b=tmp;
		}
		if(b>c){
			tmp=b;
			b=c;
			c=tmp;
		}
		if(c>d){
			tmp=c;
			c=d;
			d=tmp;
		}
		if(d>e){
			tmp=d;
			d=e;
			e=tmp;
		}
		if(e>f){
			tmp=e;
			e=f;
			f=tmp;
		}
		if(f>g){
			tmp=f;
			f=g;
			g=tmp;
		}
		if(g>h){
			tmp=g;
			g=h;
			h=tmp;
		}
		if(h>i){
			tmp=h;
			h=i;
			i=tmp;
		}
		if(i>j){
			tmp=i;
			i=j;
			j=tmp;
		}
	}
	printf("%d\n%d\n%d\n",j,i,h);
	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using ll = long long;

int main()
{
    int n;
    std::cin >> n;
    std::map<std::string , int> map;
    for(int i = 0; i < n; i++){
        std::string t;
        std::cin >> t;
        map[t]++;
    }
    int max = 0;
    for(auto i : map){
        max = std::max(i.second, max);
    }
    for(auto i : map){
        if(i.second == max)std::cout << i.first << std::endl;
    }
}

Measured memory_bytes: 27264
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

int main() {
  int N;
  int cnt = 0;
  cin >> N;
  bool f = false;
  rep(i, N) {
    int d1, d2;
    cin >> d1 >> d2;
    if(d1 == d2) {
      cnt++;
    } else {
      cnt = 0;
    }
    if(cnt >= 3) {
      f = true;
      
    }
  }
  if(f) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<queue>
#include<string>
#include<iostream>
#define R(i, n) for(int i = 0; i < n; i++)
#define S(a) scanf("%d", &a)
#define S2(a, b) scanf("%d%d", &a, &b)
#define S3(a, b, c) scanf("%d%d%d",  &a, &b, &c)
#define SL(a) scanf("%lld", &a)
#define P(a) printf("%d", a)
#define PL(a) printf("%lld", a);
#define PY printf("%s", "Yes");
#define PN printf("%s", "No");
#define INF 1000000000
using namespace std;
typedef long long ll;
typedef pair<int, int> IR;

int main(){
	ll n, k;
	SL(n);
	SL(k);
	ll mod = n % k;
	ll diff = k - mod;
	PL(min(mod, diff));
}

Measured memory_bytes: 3712
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		int a = sc.nextInt(), b = sc.nextInt(), c = sc.nextInt();

		if(((a == b)&&(a != c))||((a == c)&&(b != c))||((c == b)&&(a != c))){
			pw.print("Yes");
		}else {
			pw.print("No");
		}
		pw.close();
	}

	static  class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}

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

int main() {
	int N, a;
	long sum=0, ans=0; 
	cin >> N;
	for(int i=0; i<N; ++i){
	    cin >> a;
	    if(a>0) sum += a;
	    else{
	        ans += sum/2;
	        sum=0;
	    }
	}
	ans += sum/2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map{ it.toInt() }.sortedDescending()
    var alice = 0
    var bob = 0
    for (i in 0 until n) {
        if (i % 2 == 0) {
            alice += a[i]
        } else {
            bob += a[i]
        }
    }
    println(alice - bob)
}


Measured memory_bytes: 37576
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    cout<<min(c,b/a)<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define X first
#define Y second
#define rep(X,Y) for(int X=0;X<(Y);++X)

using namespace std;

typedef pair<int,int> pii;

int dx[]={1,1,0,-1,-1,0},dy[]={0,1,1,0,-1,-1};

int d[1000][1000],INF=1000;

int main(){
  int t,n;
  while(cin>>t>>n,t||n){
    fill(d[0],d[0]+1000000,INF);
    int x,y;
    rep(i,n){
      cin>>x>>y;
      d[y+500][x+500]=-1;
    }
    cin>>x>>y;
    d[y+500][x+500]=0;
    queue<pii> que;
    que.emplace(x,y);
    while(!que.empty()){
      pii cur=que.front(); que.pop();
      if(d[cur.Y+500][cur.X+500]>t)break;
      rep(i,6){
	pii nxt=cur;
	nxt.X+=dx[i]; nxt.Y+=dy[i];
	if(d[nxt.Y+500][nxt.X+500]>d[cur.Y+500][cur.X+500]+1){
	  d[nxt.Y+500][nxt.X+500]=d[cur.Y+500][cur.X+500]+1;
	  que.push(nxt);
	}
      }
    }
    int re=0;
    rep(i,1000)rep(j,1000)
      re+=d[i][j]<=t && d[i][j]>=0;
    cout<<re<<endl;
  }
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll n, ans;

int main()
{
    ll i, j;

    scanf("%lld", &n);
    for(i=1; i*i<n; i++)
    {
        if(n%i!=0) continue;
        ll a=i-1, b=n/i-1;
        if(a!=0 && n/a==n%a) ans+=a;
        if(b!=0 && n/b==n%b) ans+=b;
    }
    if(i*i==n && n/i==n%i) ans+=i;
    printf("%lld", ans);
}


Measured memory_bytes: 256
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

n,k = inp
n.times do
  s = gets
  puts s
  puts s
end

Measured memory_bytes: 1788
#include<stdio.h>
char n[200005];
int main(){
    int i,ans;
    ans = 0;
    for(i=0;i<200005;i++){
        n[i] = '0';
    }
    scanf("%s",&n);
    for(i=0;i<200005;i++){
        if(n[i] == '1'){
            ans = ans+1;
        }else if(n[i] == '2'){
            ans = ans+2;
        }else if(n[i] == '3'){
            ans = ans+3;
        }else if(n[i] == '4'){
            ans = ans+4;
        }else if(n[i] == '5'){
            ans = ans+5;
        }else if(n[i] == '6'){
            ans = ans+6;
        }else if(n[i] == '7'){
            ans = ans+7;
        }else if(n[i] == '8'){
            ans = ans+8;
        }else if(n[i] == '9'){
            ans = ans+9;
        }
    }
    if(ans%9 == 0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1840
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>
#include <locale>
#include <random>
#include <type_traits>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

using LL = long long;

//------------------------------------------
//------------------------------------------

int main() {

    int N;
    cin >> N;

    vector<int> a(N);
    for (int i = 0; i < N; i++) cin >> a[i];

    if (count(a.begin(), a.end(), 0) == N) {
        cout << "Yes" << endl;
        return 0;
    }

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

    map<int, int> mp;
    for (auto x : a) mp[x]++;

    if (mp.size() == 2) {
        int x = mp.begin()->second;
        int y = next(mp.begin())->second;
        bool good = false;
        for (auto x: mp) if (x.first == 0 && x.second == N / 3) good = true;
        if (x < y) swap(x, y);
        if (x == N / 3 * 2 && good)cout << "Yes" << endl;
        else cout << "No" << endl;
        return 0;
    } else if (mp.size() == 3) {
        bool good = true;
        for (auto x: mp) if (x.second != N / 3) good = false;
        int z = 0;
        for (auto x: mp) z ^= x.first;
        if (good && z == 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}



























































Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
#define BS 313
#define ull unsigned long long
#define rint register int
#define gc() getchar()
inline int read(int r=0,int s=0,int c=gc()){for(;c<48||c>57;s=c,c=gc());for(;c>=48&&c<=57;(r*=10)+=c-48,c=gc());return s^'-'?r:-r;}
ull H[605][605], R[605][605], B[605]; char S[605][605]; int n, Ans;
inline ull HH(int i, int l, int r){return H[i][r]-H[i][l-1]*B[r-l+1];}
inline ull HR(int j, int l, int r){return R[r][j]-R[l-1][j]*B[r-l+1];}
inline bool Check(int a, int b)
{
	for(rint i = 1, x = a, y = b; i <= n; i++, x = x%n+1, y = y%n+1)
		if(HH(x,y,y+n-1) != HR(y,x,x+n-1)) return false; return true;
}
int main()
{
	n = read(); for(rint i = 1, j; i <= n; i++) for(scanf("%s",S[i]+1), j = 1; j <= n; S[i+n][j] = S[i][j+n] = S[i+n][j+n] = S[i][j], j++);
	B[0] = 1; B[1] = BS; for(rint i = 2; i <= n<<1; B[i] = B[i-1]*BS, i++);
	for(rint i = 1, j; i <= n<<1; i++) for(j = 1; j <= n<<1; H[i][j] = H[i][j-1]*BS+S[i][j], j++);
	for(rint j = 1, i; j <= n<<1; j++) for(i = 1; i <= n<<1; R[i][j] = R[i-1][j]*BS+S[i][j], i++);
	for(rint A = 1, B; A <= n; A++) for(B = 1; B <= n; B++) Ans += Check(A,B); printf("%d\n",Ans); return 0;
}

Measured memory_bytes: 6272
#!/usr/bin/env python3
import sys
from copy import copy

def chk(shoji, N, A, x, y):
    for chk in range(N):
        if shoji[chk]==0: continue
        for s in range(A[chk]):
            if ((y[chk][s]==1 and shoji[x[chk][s]-1]!=1) or 
                (y[chk][s]==0 and shoji[x[chk][s]-1]!=0)):
                return False
    return True

def solve(N: int, A: "List[int]", x: "List[int][int]", y: "List[int][int]"):
    fmt="0"+str(N)+"b"
    ans=0
    for kans in range(2**N):
        lst=list(format(kans,fmt))
        if chk([int(c) for c in lst], N, A, x, y):
            ans=max(ans, lst.count('1'))
    print(ans)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A=[0]*N
    x=[[0 for i in range(N)] for j in range(15)]
    y=[[0 for i in range(N)] for j in range(15)]
    for k in range(N):
        A[k] = int(next(tokens))
        for l in range(A[k]):
            x[k][l] = int(next(tokens))
            y[k][l] = int(next(tokens))
    solve(N, A, x, y)

if __name__ == '__main__':
    main()


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

int main(){
	int n;
	cin>>n;
	double a[n+1];
	string s[n+1];
	double ans;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i]>>s[i];
		if(s[i]=="JPY")
		{
			ans+=a[i]*1.0;
		}
		else
		{
			ans+=a[i]*1.0*380000;
		}
	}
	cout<<ans<<endl;	
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <list>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <stack>
#include <fstream>
#include <queue>
#include <iomanip>
#include <iterator>
#include <map>
#include <unordered_map>
#include <set>
#define fast ios_base::sync_with_stdio(false)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vvi vector<vi >
#define pi pair<ll,ll>
#define vvpi vector<vector<pi > >
#define vpi vector<pi >
#define vppi vector<pair<ll,pi > >
#define vs vector<string>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define eb emplace_back
#define mkp make_pair
#define fs first
#define se second
#define crz(v,n) v.clear(),v.resize(n+1,0)
#define print(v) for(ll it=0;it<v.size();it++) cout<<v[it]<<" ";cout<<endl
#define printp(v) for(ll it=0;it<v.size();it++) cout<<v[it].first<<" "<<v[it].second<<endl
using namespace std;
int main(){
	ll i,n,s,c=1;cin>>n;vi v(n);for(i=0;i<n;i++) cin>>v[i];s=v[0];
	for(i=1;i<n;i++){
		if(v[i]<s) c++;
		s=min(s,v[i]);
	}cout<<c<<endl;
}


Measured memory_bytes: 1792
d = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _i in range(d)]

last_days = [-1 for _i in range(26)]
result = []
for today in range(d):
    checker = [s[today][j]-c[j]*(today-last_days[j]) for j in range(26)]
    x = checker.index(min(checker))
    last_days[x] = today
    result.append(x+1)
for i in result:
    print(i)

Measured memory_bytes: 73908
#include <bits/stdc++.h>
   
int main(){
    int n, m;
   
    while(scanf("%d%d" ,&n ,&m), (n | m)){
	int N = n+m, arr[N];
	for(int i = 0 ; i < N ; i++){
	    scanf("%d" ,arr+i);
	}
	std::sort(arr, arr+N);
   
	int max = arr[0];
	for(int i = 0 ; i < N ; i++){
	    max = std::max(max, arr[i] - arr[i-1]);
	}
	printf("%d\n" ,max);
    }  
    return 0;
}

Measured memory_bytes: 3284
#include<stdio.h>
int main() {
	int x,y,r;
	while(1) {
		scanf("%d %d",&x,&y);
		if(x == 0 && y == 0) break;
		if(x > y) {
			r = x; x = y; y = r;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}

Measured memory_bytes: 1768
n=int(input())
a=[]
am,amm=0,0
for i in range(n):
    x=int(input())
    if x>am:
        am,amm=amm,x
    elif x>amm:
        amm=x
    a.append(x)
for i in range(n):
    if a[i]==am:
        print(amm)
    else:
        print(am)

Measured memory_bytes: 17040
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    k,x = LI()
    if k*500 >= x:
        return 'Yes'

    return 'No'


print(main())





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

int main() {
    int x, y;
    cin >> x >> y;
    int ans = 1001001001;
    if (x <= y) ans = min(ans, y - x);
    if (-x <= y) ans = min(ans, y - -x + 1);
    if (x <= -y) ans = min(ans, -y - x + 1);
    if (-x <= -y) ans = min(ans, - y - -x + 2);
    cout << ans << endl;
}


Measured memory_bytes: 256