akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
*/

int main(){
    int N; cin >> N;
    vector<int> a(N+1, 10000000);
    int ans = 0;

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

    bool flg = false;
    int cnt = 0;
    for(int i=1; i<N+1; i++){
        if(flg == false && a[i] == a[i-1]){
            flg = true;
            cnt = 2; 
        }
        else if(flg == true && a[i] == a[i-1]) cnt++;
        else if(flg == true && a[i] != a[i-1]){
            flg = false;
            ans += cnt/2;
            cnt = 0;
        }
        
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <numeric>
#include <iterator>
#include <cstring>
using namespace std;

int n;
vector<int> e[1005];
int a[1005];
int d[1005];

bool knapsack[5005];
bool ktmp1[5005], ktmp2[5005];
bool ok = true;

void solve(int x) {
	for (int y : e[x]) {
		solve(y);
	}

	// Koji je najmanji zbir druge boje koji mogu da imam.

	memset(knapsack, 0, sizeof(knapsack));
	knapsack[0] = true;
	for (int y : e[x]) {
		memset(ktmp1, 0, sizeof(ktmp1));
		memset(ktmp2, 0, sizeof(ktmp2));

		for (int i=0; i + d[y] <= 5000; i++) {
			ktmp1[i + d[y]] = knapsack[i];
		}

		for (int i=0; i + a[y] <= 5000; i++) {
			ktmp2[i + a[y]] = knapsack[i];
		}

		for (int i=0; i <= 5000; i++) {
			knapsack[i] = ktmp1[i] | ktmp2[i];
		}
	}

	int f = -1;
	// uzmi najblizu a[x]
	for (int i=a[x]; i>=0; i--) {
		if (knapsack[i]) {
			f = i;
			break;
		}
	}

	if (f == -1) {
		ok = false;
		return;
	}

	for (int y : e[x]) {
		d[x] += a[y] + d[y];
	}

	d[x] -= f;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cerr.tie(nullptr);

	cin >> n;
	for (int i=2; i<=n; i++) {
		int p;
		cin >> p;
		e[p].push_back(i);
	}
	for (int i=1; i<=n; i++) {
		cin >> a[i];
	}

	solve(1);
	if (ok) {
		cout << "POSSIBLE\n";
	} else {
		cout << "IMPOSSIBLE\n";
	}

}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;

int main() {
  ll a, b;
  cin >> a >> b;
  ll ans = (a + b + 1) / 2;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3528
s =input()
n = int(s)
r = 0
p=0
for bit in range(2**(len(s)-1)):
    e = s[0]
    for i in range(len(s)-1):
        if ((bit>>i)&1) == 1:
            e += '+'
        e += s[i+1]
        #print(e)
    r+= sum(map(int, e.split('+')))
    p+= eval(e)
print(r)


Measured memory_bytes: 3060
#include <iostream>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <string.h>

using namespace std;




int main()
{
    int n,k;
    cin>>n>>k;
    int i;
    int a[n];
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    int s=0;
    for(i=0;i<k;i++)
    s+=a[i];
    printf("%d",s);

    return 0;
}


Measured memory_bytes: 3764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k; cin >> n >> k;
  vector<pair<ll, int>> S(n);
  rep(i, n) {
    cin >> S[i].second >> S[i].first;
    S[i].second--;
  }
  sort(all(S), greater<pair<ll, int>>());
  ll cur = 0;
  vector<ll> ans(n+1, -longinf);
  priority_queue<pair<ll, int>> q1;
  priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> q2;
  set<int> se;
  rep(i, n) {
    if(i < k) {
      cur += S[i].first;
      if(se.count(S[i].second)) q2.push(S[i]);
      se.insert(S[i].second);
    } else {
      if(!se.count(S[i].second)) q1.push(S[i]);
    }
  }
  ans[se.size()] = cur + se.size()*se.size();
  while(!q1.empty()) {
    auto ele = q1.top(); q1.pop();
    if(se.count(ele.second)) continue;
    if(q2.empty()) break;
    auto ele2 = q2.top(); q2.pop();
    cur += ele.first - ele2.first;
    se.insert(ele.second);
    ans[se.size()] = cur + se.size()*se.size();
  }
  cout << *max_element(all(ans)) << "\n";
  return 0;
}


Measured memory_bytes: 9496
from heapq import heappop, heappush

def main():
  R, D, L, U = 0, 1, 2, 3
  vector = ((1, 0), (0, 1), (-1, 0), (0, -1))
  
  while True:
    w, h = map(int, input().split())
    if w == 0:
      break
    mp = [[5] + list(map(int, input().split())) + [5] for _ in range(h)]
    mp.insert(0, [5] * (w + 2))
    mp.append([5] * (w + 2))
    cost = list(map(int, input().split()))
    que = []
    heappush(que, (0, 1, 1, R))
    dic = {}
    dic[(1, 1, R)] = 0
    while que:
      total, x, y, direct = heappop(que)
      ins = mp[y][x]
      if ins == 5:
        continue
      if ins != 4:
        new_direct = (direct + ins) % 4
        vx, vy = vector[new_direct]
        nx, ny = x + vx, y + vy
        if not (nx, ny, new_direct) in dic or dic[nx, ny, new_direct] > total:
          dic[(nx, ny, new_direct)] = total
          heappush(que, (total, nx, ny, new_direct))
  
      for add_direct in range(4):
        new_direct = (direct + add_direct) % 4
        vx, vy = vector[new_direct]
        nx, ny = x + vx, y + vy
        if not (nx, ny, new_direct) in dic or dic[(nx, ny, new_direct)] > total + cost[add_direct]:
          dic[(nx, ny, new_direct)] = total + cost[add_direct]
          heappush(que, (total + cost[add_direct], nx, ny, new_direct))
    print(min(dic[(w, h, D)], dic[(w, h, R)]))

main()


Measured memory_bytes: 6304
#include<bits/stdc++.h>
/*
alias g='g++ -std=c++17 -O2 pra.cpp'
cd programming
cd cpp
cd practice

*/
using namespace std;
double PI = acos(-1);
struct point{
    double x;
    double y;
};
void kock(int n, point p1, point p2){
    if (n == 0) return;
    point s, t, u;//再帰的に座標を計算
    s.x=((p1.x/3.0)*2.0)+(p2.x/3.0);
    s.y=((p1.y/3.0)*2.0)+(p2.y/3.0);
    t.x=((p2.x/3.0)*2.0)+(p1.x/3.0);
    t.y=((p2.y/3.0)*2.0)+(p1.y/3.0);
    u.x = (t.x - s.x)* cos(PI/3.0) - (t.y - s.y)* sin(PI/3.0) + s.x;
    u.y = (t.x - s.x)* sin(PI/3.0) + (t.y - s.y)* cos(PI/3.0) + s.y;
    kock(n-1, p1, s);
    printf("%.6f %.6f\n", s.x, s.y);
    kock(n-1, s, u);
    printf("%.6f %.6f\n", u.x, u.y);
    kock(n-1, u, t);
    printf("%.6f %.6f\n", t.x, t.y);
    kock(n-1, t, p2);
}//uはsを基準にtを60度回転させたもの
int main(){
    int n; cin >> n;
    printf("%.6f %.6f\n", 0.0000000, 0.0000000);
    point def, last;
    def.x = 0.0;
    def.y = 0.0;
    last.x = 100.0;
    last.y = 0.0;
    kock(n, def, last);
    printf("%.6f %.6f", 100.000000, 0.0000000);
    return 0;
}


Measured memory_bytes: 3388
#include <bits/stdc++.h>
#define MOD 998244353
#define pb push_back
#define ll long long int
#define con 1000000007
using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll i,j,m,n,k;
    ll t;
    cin>>n;
    unordered_map<string,ll> u;
    for(i=0;i<n;i++)
    {
        string s;
        cin>>s;
        u[s]++;
    }
    cout<<"AC x "<<u["AC"]<<"\n";
    cout<<"WA x "<<u["WA"]<<"\n";
    cout<<"TLE x "<<u["TLE"]<<"\n";
    cout<<"RE x "<<u["RE"]<<"\n";
}





Measured memory_bytes: 3684
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 N, K;
  cin >> N >> K;
  vector<i64> P(N);
  rep(i,0,N) {
    cin >> P[i];
  }
  sort(all(P));
  i64 ans = 0;
  rep(i,0,K) {
    ans += P[i];
  }
  cout << ans << endl;

}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
            using namespace std;
            typedef long long ll;
            typedef long double ld;
            typedef pair<ll, ll> l_l;
            typedef pair<int , int> i_i;
            typedef vector<ll> vl;
            typedef vector<int> vi;
            typedef vector<char> vec;
            typedef vector<bool> veb;
            typedef vector<string> ves;
            typedef vector<vector<ll>> vvl;
            typedef vector<vector<int>> vvi;
            typedef vector<vector<char>> vvec;
            typedef vector<vector<bool>> vveb;
            typedef vector<vector<string>> vves;
            #define rep(i,n) for(int i=0;i<(int)(n);i++)
            #define rep1(i,n) for(int i=1;i<(int)(n);i++)
            #define rep2(i,n) for(int i=2;i<(int)(n);i++)
            #define repk(i,k,n) for(int i=k;i<(int)(n);i++)
            #define fs first
            #define sc second
            #define pb push_back
            #define pp pop_back
            #define all(a) a.begin(),a.end()
            #define rall(a) a.rbegin(),a.rend()
            #define maxel(a) *max_element(all(a))
            #define minel(a) *min_element(all(a))
            #define acc accumulate
            #define EPS (1e-7)
            #define INF (1e9)
            #define PI (acos(-1))
            #define mod (1000000007)
            typedef long long int64;
            //const int64 INF = 1LL << 58;
            #define dame { puts("-1"); return 0;}
            #define YES { cout << "YES" << endl; return 0; }
            #define NO { cout << "NO" << endl; return 0; }
            #define Yes { cout << "Yes" << endl; return 0; }
            #define No { cout << "No" << endl; return 0; }
            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; }
            int dx[] = {0, 0, -1, 1};
            int dy[] = {1, -1, 0, 0};
             
            int main(){
            	cin.tie(0);
            	ios::sync_with_stdio(false);
             
              	int n;
              	cin >> n;
              	vi a(n);
          
              	rep(i,n){cin >> a.at(i);}
              	rep(i,n){
                        if(a.at(i)%2 == 0){
                        	if(a.at(i)%3 != 0 && a.at(i)%5 != 0){cout << "DENIED" << endl;return 0;} 
                        }      
                }
              cout << "APPROVED" << endl;
              return 0;  
            }

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <iostream>
#include <memory>
#include <numeric>

#include <array>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <unordered_map>
#include <deque>
#include <unordered_set>
#include <vector>

#include <cstring>
#include <ostream>
#include <type_traits>
#include <utility>
#include <chrono>
#include <random>

#ifdef ONLINE_JUDGE
#pragma GCC optimize ("O2")
#pragma GCC target ("avx,avx2")
#endif

using namespace std;

using u64 = uint64_t;
using i64 = int64_t;
using u32 = uint32_t;
using vi = vector<int>;
using vi64 = vector<i64>;

#define seq(i,a,b) for (int i = (a); i < (b); ++i)
#define rev(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define dbg(x) {cerr << #x << ": " << x << endl;}

int main(int argc, char *argv[])
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int h,w; cin >> h >> w;    
    vector<string> M;
    seq(_, 0, h) {
      string s; cin >> s;
      M.push_back(s);
    }

    auto at = [&](int x, int y) {
      if (0 <= x && x < w && 0 <= y && y < h) {
        return M[y][x] == '.';
      }
      return false;
    };

    vector<pair<int, int>> roads;
    seq(i,0,h) seq(j,0,w) {
        if (at(j,i)) roads.push_back(make_pair(j,i));
    }

    auto dist = [&](int aa, int bb, int cc, int dd) {
      deque<tuple<int,int,int>> Q;
      Q.push_back(make_tuple(0, aa, bb));

      array<bool, 1000> seen = {};

      while (!Q.empty()) {
        int d, x, y;
        tie(d,x,y) = Q.front();
        Q.pop_front();

        if (x == cc && y == dd) return d;

        if (seen[x + y*30]) continue;
        seen[x + y*30] = true;

        if (at(x,y+1))
            Q.push_back(make_tuple(d+1, x, y+1));
        if (at(x,y-1))
            Q.push_back(make_tuple(d+1, x, y-1));
        if (at(x+1,y))
            Q.push_back(make_tuple(d+1, x+1, y));
        if (at(x-1,y))
            Q.push_back(make_tuple(d+1, x-1, y));
      }

      return -1;
    };

    int mx = 0;
    for (auto a : roads) for (auto b : roads) {

      mx = max(mx, dist(
            get<0>(a),
            get<1>(a),
            get<0>(b),
            get<1>(b) 
            ));
    }
    cout << mx << endl;
}


Measured memory_bytes: 256
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

const int MAX = 510000;
 const int MOD = 1000000007;
 
 long long fac[MAX], finv[MAX], inv[MAX];
 
 // テーブルを作る前処理
 void COMinit() {
     fac[0] = fac[1] = 1;
     finv[0] = finv[1] = 1;
     inv[1] = 1;
     for (int i = 2; i < MAX; i++){
         fac[i] = fac[i - 1] * i % MOD;
         inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
         finv[i] = finv[i - 1] * inv[i] % MOD;
     }
 }
 
 // 二項係数計算
 long long COM(int n, int k){
     if (n < k) return 0;
     if (n < 0 || k < 0) return 0;
     return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
 }
int main() {
    ll n,m;
    COMinit();
    std::cin >> n>>m;
    if((ll)abs(n-m)>1){
        std::cout << 0 << std::endl;
    }else if(n==m){
        std::cout << fac[n]*fac[m]%MOD*2%MOD << std::endl;
    }else{
        std::cout << fac[n]*fac[m]%MOD << std::endl;
    }
}


Measured memory_bytes: 12160
#include <stdio.h>
#include <iostream>
#include <string>
#include <math.h>

using namespace std;

int main()
{
	string a, b;
	cin >> a >> b;

	int x;
	sscanf((a+b).c_str(), "%d", &x);

	double y = sqrt(x);

	if(y-(int)y == 0 ) cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
import numpy as np
n, m = list(map(lambda x: int(x), input().split(' ')))
h = list(map(lambda x: int(x), input().split(' ')))
bo = list(map(lambda x: True, h))

for i in range(m):
  a, b = list(map(lambda x: int(x), input().split(' ')))
  if h[a-1] == h[b-1]:
    bo[a-1] = False
    bo[b-1] = False
  elif h[a-1] > h[b-1]:
    bo[b-1] = False
  elif h[a-1] < h[b-1]:
    bo[a-1] = False
print(sum(bo))

Measured memory_bytes: 38624
#include<cstdio>
#include<algorithm>
#include<vector>
#define N_ 101000
using namespace std;
int D[1010][1010], Mod = 1000000007, n, m;
char p[1010][1010];
int main() {
	int i, a, b, j;
	scanf("%d%d", &n,&m);
	for (i = 1; i <= n; i++) {
		scanf("%s", p[i] + 1);
		for (j = 1; j <= m; j++) {
			if (p[i][j] == '#') {
				D[i][j] = 0;
				continue;
			}
			if (i == 1 && j == 1) {
				D[i][j] = 1;
				continue;
			}
			D[i][j] = 0;
			if (i != 1) {
				D[i][j] = D[i - 1][j];
			}
			if (j != 1) {
				D[i][j] = (D[i][j] + D[i][j - 1]) % Mod;
			}
		}
	}
	printf("%d\n", D[n][m]);
}


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

using ll = long long;

int main() {
    ll n, x, m;
    cin >> n >> x >> m;
    ll f, r;
    f = r = 0;
    ll p, p2;
    p = p2 = x;
    for (ll i = 0; i < 2*m; ++i) {
        (p *= p) %= m;
        (p2 *= p2) %= m;
        (p2 *= p2) %= m;
        if (p == p2) break;
    }
    ll sf = 0;
    p = x;
    while (p != p2) {
        sf += p;
        (p *= p) %= m;
        (p2 *= p2) %= m;
        ++f;
    }
    ll sr = p;
    (p *= p) %= m;
    ++r;
    while (p != p2) {
        sr += p;
        (p *= p) %= m;
        ++r;
    }
    ll ans = 0;
    if (n <= f) {
        ll tp = x;
        ans = tp;
        for (ll i = 0; i < n-1; ++i) {
            (tp *= tp) %= m;
            ans += tp;
        }
    } else {
        ans = sf;
        ll a = (n - f) / r;
        ll b = n - f - a*r;
        ans += a * sr;
        for (ll i = 0; i < b; ++i) {
            ans += p2;
            (p2 *= p2) %= m;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	long long d,t,s;
    scanf("%lld%lld%lld",&d,&t,&s);
     long  x = s*t;
  if(x >= d) cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <stdio.h>

using namespace std;

const int m = 1000003;

int h1(int key) {
    return key % m;
}

int h2(int key) {
    return 1 + (key % (m - 1));
}

int h(int key, int i) {
    return (h1(key) + i * h2(key)) % m;
}

int getInt(char c) {
    switch(c) {
        case 'A':
            return 1;
        case 'C':
            return 2;
        case 'G':
            return 3;
        case 'T':
            return 4;
        default:
            return 0;
    }
}

long long getKey(string str) {
    long long sum = 0, p = 1;
    for(int i = 0; i < str.size(); i++) {
        sum += p * getInt(str[i]);
        p *= 5;
    }
    return sum;
}

class Dictionary {
public:
    Dictionary();
    void insert(string str);
    string find(string str);
private:
    string * data = new string[m];
};

Dictionary::Dictionary() {
    for(int i = 0; i < m; i++) data[i] = string("N");
}

void Dictionary::insert(string str) {
    int i = 0, hash_key;
    while(i < m) {
        hash_key = h(int(getKey(str)), i);
        if(data[hash_key] == "N") {
            data[hash_key] = str;
            break;
        }
        else if(data[hash_key] == str) break;
        i++;
    }
}

string Dictionary::find(string str) {
    int i = 0, hash_key;
    while(i < m) {
        hash_key = h(int(getKey(str)), i);
        if(data[hash_key] == "N") return string("no");
        else if(data[hash_key] == str) return string("yes");
        i++;
    }
    return string("no");
}


int main() {
    int n;
    Dictionary D;

    cin >> n;
    char operation[7], operand[13];
    for(int i = 0; i < n; i++) {
        scanf("%s %s", operation, operand);
        if(operation[0] == 'i') D.insert(string(operand));
        else cout << D.find(string(operand)) << endl;
    }
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


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


const int MAX_N = 112345;
ll A[MAX_N];
ll X[MAX_N];

int main2() {
  int N = nextInt();
  REP(i, N) A[i] = nextInt();

  ll S = 0;
  for (int i = 0; i < N; i++) {
    if (i % 2 == 0)
      S += A[i];
    else
      S -= A[i];
  }

  X[0] = S;
  for (int i = 1; i < N; i++) {
    X[i] = 2*A[i-1] - X[i-1];
  }

  REP(i, N) {
    if (i > 0) printf(" ");
    printf("%d", (int)X[i]);
  }
  printf("\n");

  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}


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

void Main() {
    // input
    int A, B, C;
    cin >> A >> B >> C;


    // translate
    int count = 0;
    if (A == B) {
        count++;
    }
    if (B == C) {
        count++;
    }
    if (C == A) {
        count++;
    }

    // output
    if (count == 1) {
        cout << "Yes";
    } else {
        cout << "No";
    }

}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
using namespace std;
int main(){
        int c[3][3];
        for(int i=0; i<3; i++) {
                for(int j=0; j<3; j++) {
                        cin >> c[i][j];
                }
        }
        int a[3],b[3];
        a[0]=0;
        a[1]=c[1][0]-c[0][0];
        a[2]=c[2][0]-c[0][0];
        b[0]=c[0][0];
        b[1]=c[0][1];
        b[2]=c[0][2];
        for(int i=0; i<3; i++) {
                for(int j=0; j<3; j++) {
                        if(c[i][j]!=a[i]+b[j]){
                          cout <<"No" << endl;
                          return 0;
                      }
                }
        }
        cout <<"Yes"<< endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-8;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()



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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,f,n) for(int i=f; i<(n); i++)
int main()
{
  ll ans = 0, mod = 1000000007;
  //                 687043386
  //                 294867501
  int s;
  cin >> s;
  ll dp[s+1] = {0};
  dp[0]=1;
  REP(i,0,s+1){
    REP(j,3,i+1){
      dp[i] += dp[i-j];
      dp[i] %= mod;
    }
  }
  cout << dp[s] << endl;

  //--debug : end_stoper
  //string end_stoper; cin >> end_stoper;

  return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> bs(m);
  for (auto &v : bs)
    cin >> v;

  int ans = 0;
  while (n--) {
    int vsum = c;
    for (int i = 0; i < m; ++i) {
      int tmp;
      cin >> tmp;
      vsum += bs[i] * tmp;
    }
    ans += 0 < vsum;
  }

  cout << ans << endl;
}

Measured memory_bytes: 3644
// cited from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8.
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// My code -----------------------------------------

use std::collections::HashMap;
use std::vec::Vec;

// const DAYS: u32 = 365;
const TYPES: usize = 26;

fn compute_score(c: &[i64], sd: &Vec<Vec<i64>>, history: &[usize], current_type: usize) -> i64 {
    let d = history.len() as i64;
    let mut score: i64 = sd[d as usize][current_type];
    let mut last = HashMap::new();
    for (i, t) in history.iter().enumerate() {
        last.insert(t, i as i64);
    }
    last.insert(&current_type, d);

    for t in 0..TYPES {
        match last.get(&t) {
            Some(last_d) => score -= c[t] * (d - last_d),
            None => score -= c[t] * (d + 1),
        }
    }

    score
}

fn main() {
    input! {
        days: u32,
        c : [i64; TYPES],
        sd: [[i64; TYPES]; days],
        t : [usize; days],
    }

    let mut history = Vec::<usize>::new();
    let mut score: i64 = 0;
    for ct in t {
        let current_type = ct - 1;
        score += compute_score(&c[..], &sd, &history[..], current_type);
        history.push(current_type);
        println!("{}", score);
    }
}


Measured memory_bytes: 2280
fun main(args: Array<String>) {
    abc146d()
}

private const val UNDEFINED = -1

private data class Edge(val to: Int, val index: Int)

fun abc146d() {
    val n = readLine()!!.toInt()
    val abList = (1 until n).map { readLine()!!.split(' ').map { it.toInt() - 1 } }
        .map { Pair(it[0], it[1]) }

    val graph = Array(n) { mutableListOf<Edge>() }
    abList.forEachIndexed { index, pair ->
        val (left, right) = pair
        graph[left].add(Edge(right, index))
        graph[right].add(Edge(left, index))
    }

    val lines = Array(n - 1) { UNDEFINED }

    fun dfs(index: Int, pIndex: Int, pColor: Int) {
        val edges = graph[index]
        var color = 0
        for (edge in edges) {
            if (edge.to == pIndex) continue
            if (lines[edge.index] != UNDEFINED) continue
            if (++color == pColor) color++
            lines[edge.index] = color
            dfs(edge.to, index, color)
        }
    }

    dfs(0, -1, -1)

    val answer = lines.joinToString(System.lineSeparator())
    println(graph.map { it.size }.max())
    println(answer)
}


Measured memory_bytes: 78920
S=list(input())
S=[int(i) for i in S]
sum_0=0
sum_1=0
if len(S)%2==1:
    S.append(2)
for i in range(0,len(S),2):
    if S[i]==1:#0から探す
        sum_0+=1
    elif S[i]==0:
        sum_1+=1
    if S[i+1]==0:
        sum_0+=1
    elif S[i+1]==1:
        sum_1+=1
if sum_0>sum_1:
    print(sum_1)
else:
    print(sum_0)


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

#define pb push_back

const int N = 105 , M = 1e5+5;;
int n , k , A[N] , st[M];

main(){

  cin >> n >> k;

  memset(st,-1,sizeof(st)) , st[0] = 0;
  for(int i = 1 ; i <= n ; i++) cin >> A[i];

  for(int i = 1 ; i <= k ; i++){

    vector<int> vec;

    for(int j = 1 ; j <= n ; j++)
      if(i - A[j] >= 0) vec.pb(st[i-A[j]]);

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

    for(int j = 0 ; j < vec.size() ; j++)
      if(vec[j] != j){st[i] = j; break;}

    if(st[i] == -1) st[i] = vec.size();

  }

  //for(int i = 0 ; i <= k ; i++) cout << st[i] << " ";
  //cout << "\n";

  if(st[k]) cout << "First\n";
  else cout << "Second\n";

}


Measured memory_bytes: 640
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
a=0
for i in range(K):
    t=0
    l=T[i:N:K]
    for j in l:
        if j=="r":
            if t!=1:
                a+=P
                t=1
            else:
                t=0
        if j=="s":
            if t!=2:
                a+=R
                t=2
            else:
                t=0
        if j=="p":
            if t!=3:
                a+=S
                t=3
            else:
                t=0
print(a)

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

const int N = 16;
int n, m, tot, sz, dp[N][1 << N], e[N][N], val[1 << N];  // val: 预处理每个联通块所有边的总值

void pre() {
    rep(s, 0, sz)
        rep(i, 1, n) if ((s >> (i - 1)) & 1)
            rep(j, i + 1, n) if ((s >> (j - 1)) & 1)
                val[s] += e[i][j];
}

void chkmax(int &x, int y) { x = max(x, y); }

int main() {
    cin >> n >> m;
    sz = (1 << n) - 1;
    rep(i, 1, m) {
        int x, y, z; scanf("%d%d%d", &x, &y, &z);
        e[x][y] = e[y][x] = z; tot += z;
    }
    pre();
    
    memset(dp, -1, sizeof(dp));
    dp[1][1] = 0;
    rep(s, 1, sz)
        rep(i, 1, n)
            if (((s >> (i - 1)) & 1) && dp[i][s] != -1) {
                rep(j, 1, n)
                    if (!((s >> (j - 1)) & 1) && e[i][j])
                        chkmax(dp[j][s | (1 << (j - 1))], dp[i][s] + e[i][j]);  // e[i][j] 作为桥边
                int S = (sz ^ s) | (1 << (i - 1));
                for (int j = S; j; j = (j - 1) & S)
                    if (j & (1 << (i - 1)))
                        chkmax(dp[i][s | j], dp[i][s] + val[j]);
            }
    printf("%d\n", tot - dp[n][sz]);
    return 0;
}


Measured memory_bytes: 4480
#include "bits/stdc++.h"

#define REP(i,num) for(int i=0;i<(num);++i)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto& x:c){cout<<x<<' ';}cout<<endl;

using namespace std;
using ll = long long;

template<typename T=int>
T in(){T x; cin >> x; return (x);}

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

  int T=in(),X=in();
  
  cout << ((double)T/X) << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		Integer[] a = new Integer[N];
		for (int i = 0 ; i < N; i++) {
			a[i] = scanner.nextInt();
		}
		int ans = 0;
		Arrays.sort(a, Comparator.reverseOrder());
		for (int i = 0; i < N; i += 2 ) {
			ans += a[i];
			if (i + 1 < N)
				ans -= a[i + 1];
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22996
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
	int a,num[10005];
	long long b=0;
	scanf("%d",&a);
	for(int i=0;i<a;i++)
	scanf("%d",&num[i]);
	sort(num,num+a);
	for(int i=0;i<a;i++)
	b+=num[i];
	printf("%d %d %lld\n",num[0],num[a-1],b);
	return 0;
}


Measured memory_bytes: 2792
#coding:utf-8
N,K=map(int,raw_input().split())
V=map(int,raw_input().split())
VR=list(reversed(V))
ans=-10**8
for l in range(K+1):
    for r in range(K+1):
        if l+r>K or l+r>N:continue
        d=K-l-r
        buf=V[:l]; buf+=VR[:r]
        buf.sort()
        buf.reverse()
        for i in range(d):
            if len(buf)>0 and buf[-1]<0:buf.pop()
        ans=max(ans,sum(buf))
print(ans)        


Measured memory_bytes: 32748
import math
N = int(input())
XY = [list(map(int,input().split())) for _ in  range(N)]
for i in range(N):
    XY[i].append(math.atan2(XY[i][1],XY[i][0]))

XY.sort(key = lambda x:x[2])
ans = 0
tmp = [0,0]
ruisekiwa_x = [0] * N
ruisekiwa_y = [0] * N
ruisekiwa_x[0] = XY[0][0]
ruisekiwa_y[0] = XY[0][1]

for i in range(1,N):
    ruisekiwa_x[i] = ruisekiwa_x[i-1] + XY[i][0]
    ruisekiwa_y[i] = ruisekiwa_y[i-1] + XY[i][1]
    
ans = 0
for i in range(N):
    for j in range(i,N):
        if i>0: 
            tmp[0] = ruisekiwa_x[j] - ruisekiwa_x[i-1]
            tmp[1] = ruisekiwa_y[j] - ruisekiwa_y[i-1]
        else:
            tmp[0] = ruisekiwa_x[j] 
            tmp[1] = ruisekiwa_y[j] 
            
            
        ans = max(ans,math.sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]))
for i in range(N):
    if XY[i][2] < 0:
        XY[i][2] = -math.pi-XY[i][2]
    else:
        XY[i][2] = math.pi - XY[i][2]
        

XY.sort(key = lambda x:x[2])
ruisekiwa_x = [0] * N
ruisekiwa_y = [0] * N
ruisekiwa_x[0] = XY[0][0]
ruisekiwa_y[0] = XY[0][1]

for i in range(1,N):
    ruisekiwa_x[i] = ruisekiwa_x[i-1] + XY[i][0]
    ruisekiwa_y[i] = ruisekiwa_y[i-1] + XY[i][1]
    
for i in range(N):
    for j in range(i,N):
        if i>0: 
            tmp[0] = ruisekiwa_x[j] - ruisekiwa_x[i-1]
            tmp[1] = ruisekiwa_y[j] - ruisekiwa_y[i-1]
        else:
            tmp[0] = ruisekiwa_x[j] 
            tmp[1] = ruisekiwa_y[j] 
            
            
        ans = max(ans,math.sqrt(tmp[0]*tmp[0] + tmp[1]*tmp[1]))
        
print(ans)



Measured memory_bytes: 39664
S = gets.chomp
DP = Array.new(4,0)
DP[0] = 1
Mod = 10**9 + 7
S.chars.each{ |s|
  c = s == "?" ? 3 : 1
  if s == "C" || s == "?"
    DP[3] = (c*DP[3] + DP[2]) % Mod
  end
  if s == "B" || s == "?"
    DP[2] = (c*DP[2] + DP[1]) % Mod
  end
  if s == "A" || s == "?"
    DP[1] = (c*DP[1] + DP[0]) % Mod
  end
  DP[0] = c*DP[0] % Mod
}
p DP[-1]

Measured memory_bytes: 9468
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main(){
    int n, i, a, tem = 0;
    cin >> n;
    for(i=0; i<n; i++){
        cin >> a;
        tem ^= a;
    }
    if(tem) cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <bits/stdc++.h>
    
    
using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

ll f(ll a, ll n){
    return (a+n)%n;
}    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    auto compare = [](P a, P b) {
        return a.first < b.first;
    };

    std::priority_queue<
        P,
        std::vector<P>,
        decltype(compare) // 比較関数オブジェクトを指定
    > q {compare};

    ll n;
    cin>>n;
    vector<ll> in(n);
    FOR(i,0,n)cin>>in[i];
    vector<ll> out(n);
    FOR(i,0,n)cin>>out[i];
    FOR(i,0,n)q.push(P(out[i],i));
    
    ll res = 0;
    ll pre = -1;
    while(!q.empty() && pre != q.top().second){
        ll val = q.top().first;
        ll idx = q.top().second;
        pre = idx;
        q.pop();
        if(val == in[idx]) continue;
        if(val <= out[f(idx-1,n)] + out[f(idx+1,n)]) continue;
        ll dif = out[idx] - in[idx];
        ll t_res = dif/(out[f(idx-1,n)] + out[f(idx+1,n)]);
        res += t_res;
        out[idx] -= t_res*(out[f(idx-1,n)] + out[f(idx+1,n)]);

        if(out[idx]>in[idx]) q.push(P(out[idx],idx));
    }
    //FOR(i,0,n)cout<<out[i]<<" ";
    //cout<<endl;

    FOR(i,0,n) if(in[i] != out[i]) res = -1;
    cout<<res<<endl;


    

}

Measured memory_bytes: 9584
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>

int main()
{
	unsigned long long N, K;
	std::cin >> N >> K;

	std::vector<unsigned long long> H(N);
	for (int i = 0; i < N; ++i) {
		std::cin >> H[i];

	}

	std::sort(H.begin(), H.end(), std::greater<unsigned long long>());

	unsigned long long count = 0; 
	for (int i = K; i < H.size(); ++i) {
		count += H[i];
	}

	std::cout << count << std::endl;

	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,ans=0;
  cin>>A>>B;
  for(int i=0;i<2;i++)
    if(A<B){ans+=B;B--;}
    else {ans+=A;A--;}
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);

        while(true){
            int n = sc.nextInt();
            if(n == 0){
                break;
            }

            int scores[] = new int[n];
            int i;
            for(i=0; i<n; i++){
                scores[i] = sc.nextInt();
            }

            Arrays.sort(scores);

            int j, sum = 0;
            for(j=1; j<n-1; j++){
                sum += scores[j];
            }

            System.out.println(sum / (n - 2));

        }

        sc.close();

    }
}


Measured memory_bytes: 28948
use utf8;
use strict;

my $line;
chomp($line = <STDIN>);
my ($N, $M) = split(/ /, $line);
my @count = ();

for (my $i = 0; $i < $N; $i++) {
	chomp($line = <STDIN>);
    my @elems = split(/ /, $line);
    shift(@elems);
    foreach my $elem (@elems) {
    	$count[$elem]++;
    }
}

my $count = 0;
foreach my $elem (@count) {
	if ($elem == $N) {$count++;}
}

print "$count\n";

exit(0);

Measured memory_bytes: 512
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>
#define INF 0x3f3f3f3f;

using namespace std;

string s[200005];

bool cmp(string a,string b) {
        return a<b;
}

int main() {
    int n,i;
    scanf("%d",&n);
    for(i=0; i<n; i++)
        cin>>s[i];
    sort(s,s+n,cmp);
    int m=1,cnt=1;
    for(i=1; i<n; i++) {
        if(s[i].compare(s[i-1])==0)
            cnt++;
        else
            cnt=1;
        m=max(cnt,m);
    }
    cnt=1;
    if(m==1)
        cout<<s[0]<<endl;
    for(i=1; i<n; i++) {
        if(s[i].compare(s[i-1])==0)
            cnt++;
        else
            cnt=1;
        if(cnt==m)
            cout<<s[i]<<endl;
    }
}


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

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

  int total = 0;
  vector<int> values(N);

  for (int i = 0; i < N; i++) {
    cin >> values.at(i);
  }

  for (int i = 0; i < N; i++) {
    int cost;
    cin >> cost;

    int benefit = values.at(i) - cost;
    if (benefit > 0) {
      total += benefit;
    }
  }

  cout << total << endl;
}

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

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define pb push_back
#define INF 1000000000000000000
#define PI 3.14159265358979323846
#define f first
#define s second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<piii> viii;

const int MAXN = 100100;

int main()
{
    FAST_IO;

    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a*n, b) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll GCD(ll a, ll b){ return a ? GCD(b % a, a) : b; }
int main(){
    ll x;
    cin>>x;
    ll b=100LL;
    for(int i=1; i<100000; i++){
        b*=1.01;
        if(b>=x){
            cout<<i<<endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29
#define MOD 1000000007
#define Yes(f) puts((f)? "Yes" : "No")
#define YES(f) puts((f)? "YES" : "NO")
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

using Graph = vector<vector<int>>;

ll ans = 0, len;
string s;
void calc(int i, ll sum, ll n){
	if(i == len - 1){
		ans += sum + n * 10 + s[i] - '0';
		return;
	}

	calc(i + 1, sum + n * 10 + s[i] - '0', 0);
	calc(i + 1, sum, n * 10 + s[i] - '0');
}

int main(){
	cin >> s;
	len = s.length();
	calc(0, 0, 0);
	cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int n = Integer.parseInt(sc.next());
        int[] h = new int[n];
        for(int i = 0; i < n; i++){
            h[i] = Integer.parseInt(sc.next());
        }
        
        int max = 0;
        int count = 0;
        for(int i = 0; i < n-1; i++){
            if(h[i] >= h[i+1]){
                count++;
            }else{
                if(count > max){
                    max = count;
                }
                count = 0;
            }
        }
        if(count > max){
            max = count;
        }
        
        System.out.println(max);
    }
}

Measured memory_bytes: 50904
n=int(input())
li= list(int(i) for i in input().split())  
cnt=0
for i in range(1,n):
  if li[i]>li[i-1]:
    li[i]=li[i]-1
for j in range(0,n-1):
  if li[j]<=li[j+1]:
    cnt+=1
else:
  pass
if cnt==n-1:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n, m) for (int i = n; i <= m; ++i)
#define mem(a, b) memset(a, b, sizeof(a))
#define dbg(x) cout << #x << "=" << x << endl
const int maxm = 1e9 + 7;
const int maxn = 2e5 + 10;
#define gc getchar
#define ll long long
#define P pair<int, int>
template <class I>
inline void read(I &x)
{
    char c;
    I f;
    for (f = 1, c = gc(); c < '0' || c > '9'; c = gc())
        if (c == '-')
            f = -1;
    for (x = 0; c <= '9' && c >= '0'; c = gc())
        x = (x << 1) + (x << 3) + (c & 15);
    x *= f;
}
map<string,int>mp;
int main()
{
    int T;
    // read(T);
    T=1;
    while (T--)
    {
        int n;
        cin>>n;
        mp.clear();
        rep(i,1,n)
        {
            string s;
            cin>>s;
            mp[s]++;
        }
        map<string,int>::iterator it;
        int maxx=0;
        for(it=mp.begin();it!=mp.end();it++)
        {
            maxx=max(maxx,it->second);
        }
        for(it=mp.begin();it!=mp.end();it++)
        {
            if(it->second==maxx)
            cout<<it->first<<endl;
        }
    }
}

// abcda
// cbad

Measured memory_bytes: 25216
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
A = inpl()

c = Counter(A)

odd_cnt = 0
even_cnt = 0
for v in c.values():
    if v % 2 == 1:
        odd_cnt += 1
    else:
        even_cnt += 1
ans = 0
ans += odd_cnt
if even_cnt % 2 == 1:
    ans += even_cnt - 1
else:
    ans += even_cnt
print(ans)

Measured memory_bytes: 43752
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf 10000000000000
#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll n,d;
	rl2(n,d);
	ll ct=0;
	while(n>0)
	{
		ct++;
		n-=(2*d+1);
	}
	wl(ct);
	NL;
	return 0;
}

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

int main(){
	vector<int> vec1(2),vec2(2),vec3(2),vec4(2);
  cin>>vec1.at(0)>>vec1.at(1)>>vec2.at(0)>>vec2.at(1);
  int defX,defY;
  defX=vec2.at(0)-vec1.at(0);
  defY=vec2.at(1)-vec1.at(1);
  
  	vec3.at(0)=vec2.at(0)-defY;
    vec3.at(1)=vec2.at(1)+defX;
    vec4.at(0)=vec1.at(0)-defY;
  	vec4.at(1)=vec1.at(1)+defX;
  
  cout<<vec3.at(0)<<" "<<vec3.at(1)<<" "<<vec4.at(0)<<" "<<vec4.at(1)<<endl;
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

	int ans = 0;
	for(auto x : s)
		if(x == 'o')
			ans++;

	cout << ans*100 +700 << endl;

	return 0;
}

Measured memory_bytes: 256
//Sani buyuk Osman Pasa Plevneden cikmam diyor.
//FatihSultanMehmedHan
//Abdulhamid Han Elmuzaffer Daima
//Bismillahirrahmanirrahim

#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

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

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
#define ort (bas+son)/2

const lo MAX = -1000000000000000000; 
const lo MIN = 1000000000000000000; 
const lo inf = 1000000000; 
const lo KOK = 100000; 
const lo LOG = 30; 
const lo li = 100005; 
const lo mod = 1000000007; 

int n,m,cev,b,a[li],k;
string s;
vector<int> v;

inline int solve(){
	scanf("%d %d %d",&n,&m,&k);
	int bes=0;
	int yedi=0;
	if(n==5) bes++;
	if(m==5) bes++;
	if(k==5) bes++;
	if(n==7) yedi++;
	if(k==7) yedi++;
	if(m==7) yedi++;
	if(bes==2 && yedi==1){printf("YES\n");return 0;}
	printf("NO\n");
	return 0;
}

int main(void){
	solve();
	
	return 0;
}


Measured memory_bytes: 256
import sys
def input():
    return sys.stdin.readline()[:-1]


def main():
    N = int(input())
    S = list(input())
 
    c = [[] for _ in range(3)] #c = [[]] * 3 とすると全ての要素にappendされてしまうのでNG
    for i in range(len(S)):
        if S[i] == 'R':
            c[0].append(i)
        elif S[i] == 'G':
            c[1].append(i)
        else : # 'B'のとき
            c[2].append(i)
    total = len(c[0]) * len(c[1]) * len(c[2])

    reigai = 0 #先に条件2を満たすものを考えてから、条件1に当てはまるかを判定
    for i in range(N - 2):
        for j in range(i + 1, N - 1):
            k = j + (j - i)
            if k >= N:
                break
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                reigai += 1
    print(total - reigai)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9216